Asynchronous machine learning model execution
By introducing a queue mechanism in the ML controller and decoupling pre-processing and post-processing, the asynchronous execution of the ML model is realized, which solves the problem of resource waste in the existing technology and improves the processing efficiency.
Patent Information
- Application Number
- CN202410350676.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-03-29
- Filing Date
- 2024-03-26
- Publication Date
- 2024-10-01
AI Technical Summary
The existing ML model execution system wastes resources due to the synchronous design of pre-processing and post-processing. The application is idle during the execution of the ML model and cannot effectively utilize resources.
By introducing a queue mechanism in the ML controller, the ML model is allowed to be executed asynchronously, decoupling pre-processing and post-processing, ensuring that the input data is continuously provided to the ML model for processing without waiting for the post-processing of the output data to be completed.
It realizes asynchronous execution of ML models, improves resource utilization, reduces waiting time, allows pre-processing and post-processing to be performed simultaneously, and improves overall processing efficiency.
Smart Images

Figure CN118734989A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to processing data using machine learning (ML) models, and in particular to asynchronous execution of ML models. Background Art
[0002] In recent years, ML algorithms have gained recognition as solutions to various problems in multiple application areas. As a result, today's electronic devices often need to support a large number of applications that use multiple different ML models that need to be executed.
[0003] As is known in the prior art, systems for performing ML model execution have limitations due to being designed in a way that pre-processing and post-processing of data are coupled. This means that an application requesting the execution of an ML model will perform pre-processing of a first data set, provide that first data set as input to the execution of the requested ML model, but will then wait until post-processing of any output data is performed until the next pre-processing is performed and the second data set is provided to the ML model. It can also be said that these systems operate in a synchronous manner, meaning that pre-processing, processing, and post-processing are done synchronously. Thus, the execution of the ML model begins with pre-processing the data, then providing the data to the ML model, and waiting for the output until the next data is pre-processed and then provided to the ML model, and so on. It can also be said that the execution of the ML model is performed synchronously. However, this would mean that the application would be idle during the time the ML model is actually executing, as the application would actually be waiting for output data until new input data is pre-processed and provided to the ML model.
[0004] Therefore, there is a need to provide improved data processing for utilizing ML models that can provide improved timing without requiring a completely new design of existing ML model execution systems. Summary of the invention
[0005] The above needs are met by the method, computer program product and computing device for processing data using an ML model according to the present invention. It can also be said that the method, computer program product and computing device according to the present invention allow asynchronous operation of the ML model. Running an ML model is the process of processing data using an ML algorithm to calculate an output. This process is also called ML reasoning or executing an ML model. ML reasoning basically requires deploying a software application into an ML runtime environment and letting the software application run. Thus, the ML algorithm first exists in an untrained state and is then trained with training data, which refines the ML model, i.e., the weights of the ML model. The trained ML model is then used with real input data in an inference state. The present invention allows asynchronous input data processing using an ML model.
[0006] Thus, the method for processing data using ML models according to the present invention comprises receiving at least one request from at least one ML application at an ML controller to run at least one ML model. The request may thus specify the ML model to be run and may additionally include some additional information about how to run the ML model. For example, the additional information may specify a specific ML runtime to be used to run the ML model. The method also comprises queuing pre-processed input data for at least one ML model at the ML controller. The input data may be any data that has been pre-processed by the application to be used as input to the ML model. Thus, pre-processing may include putting the raw data into a format for training the ML model. However, it is contemplated that all other types of pre-processing may also be covered. The method also comprises running at least one ML model using the ML runtime by the ML controller, wherein the running comprises executing at least one ML model by the ML runtime. As described above, the execution of the ML model comprises processing the input data using the ML algorithm to produce output data. Thus, the processing of the data comprises starting to process a second set of the queued input data using the at least one ML model, the processing being independent of post-processing the output data produced by processing the first set of the queued input data. In other words, the method provides a decoupling of the processing of the input data from the pre-processing and / or post-processing of the application. This is achieved by queuing the input data and then feeding the input data from the queue to the ML model instead of feeding the input data directly from the preprocessing to the ML model. The queue acts as a buffer for the input data so that the preprocessing can be performed continuously and does not need to be performed synchronously with the ML model execution. This allows asynchronous execution of the ML model. This also leads to the decoupling of post-processing from pre-processing. As soon as the output data is available, the post-processing can start and the ML model can be fed with new input data from the queue without having to wait for the post-processing to trigger a new pre-processing because the next input data is already in the queue. Therefore, the input data is fed to the ML model from the queue instead of requesting the pre-processing function of the application, which enables the ML model to run continuously with the input data without any waiting time. This in turn also allows the application to make better use of resources because the pre-processing function can perform pre-processing continuously without waiting for the ML model execution to complete.
[0007] In a preferred aspect of the method, at least one request includes an ML model reference ID for distinguishing the ML model. If an application requests to run different ML models, the ML model reference ID can be used to distinguish the ML models. The ML model reference ID can be any numeric, binary, string, or label that can be uniquely associated with an ML model. In a non-limiting example, the ML model reference ID can be used to route corresponding input data to the corresponding ML model.
[0008] In another preferred aspect of the method, the method may further include generating an ML model instance ID for distinguishing different instances. The ML controller may generate an ML runner instance, a runner instance, or simply an instance for each requested ML model to be run. The instance may be configured to interact with the ML runtime so that the ML runtime executes the ML model. The instance may include all information, transformations, and other adjustments required to run the ML model on the ML runtime. Different instances may be distinguished by using an ML model instance ID. The ML model instance ID may be any numeric value, binary number, string, or label that can be uniquely associated with an instance. By using the ML model reference ID and the ML model instance ID, the corresponding model request may be associated with a specific model to be run. This may be particularly important if the same application requests to run multiple different models. In a non-limiting example, the ML model instance ID may be used to route the corresponding input data to the corresponding ML model.
[0009] In another preferred aspect of the method, at least one request includes an ML model execution ID for distinguishing different executions. The ML model execution ID can be any numeric, binary, string, or label that can be uniquely associated with an execution of the ML model. The ML model execution ID can be particularly useful when requesting to run the same ML model but with different input data. In this case, there may be some ambiguity between the ML model instance IDs used, so that the ML model execution ID can provide another level of refinement for the request. The ML model execution ID can also help further distinguish between run requests from different applications. The combination of the ML model instance ID and the ML model reference ID can uniquely associate a request from an application and allow the ML controller to respond accordingly. It is also envisioned in a non-limiting example that a corresponding combination of IDs is used to uniquely route the corresponding input data.
[0010] In another preferred aspect of the method, the method further comprises outputting an indication to at least one ML application once the execution of the ML model has produced output data. It can also be said that the output data is provided to the application indirectly, since only the indication is provided and not the output data itself. The indication may take the form of a callback function, which informs the application that the ML model has been inferred and the output data can be retrieved. Thus, the indication may, for example, include a memory address where to retrieve the output data. This has the advantage that the ML controller only needs to inform the application of the available outputs, so that resources remain free.
[0011] In another preferred aspect of the method, the method further comprises outputting the output data directly to at least one ML application once execution of the ML model has completed. Thus, once the ML model has been executed and the processed input data has produced the output data, the output data is provided to the application. This has the advantage of saving resources at the application compared to an indirect indication that the output is available, where the application must expend resources to collect the output data.
[0012] In another preferred aspect of the method, the step of receiving at least one request includes receiving at least one load request to initialize at least one ML model and receiving at least one execute request to cause at least one ML model to be executed. The load request may also be referred to as a request to generate an ML model runner instance. The load request may include several parameters of the ML model to be executed, such as ML model definition, memory usage, etc. If the request is successful and the ML runtime allows the creation of an ML model runner instance, the ML model runner instance is created and a reference to it is given to at least one requesting application. For example, the reference may be an ML model instance ID. This feedback to at least one application may also be referred to as sending a response to the load request to at least one application. The response may include information from the originally received run request, such as an ML model reference ID. Therefore, in the case of success, the load request may be answered with a response including the originally received ML model reference ID (to indicate that the response is related to a specific request for a specific model) and the ML model instance ID (to identify that the model runner instance has been created). By using the corresponding information, the corresponding load request is uniquely associated with the response. The execute request may then subsequently reference the model runner instance and request that the input data be processed by the ML model of the specified runner instance to be used. In other words, a load request initializes the ML model to be run, while an execute request starts processing the input data using the corresponding ML model. An execution request may include not only an ML model instance ID for identifying a specific ML runner instance generated by the ML controller for ML model execution, but also an ML model execution ID for distinguishing different executions. For example, if an application can request to execute the same ML model, the application will use the same ML model instance ID, however, if the ML model will be used with different input data (e.g., from different data sources), another layer of differentiation needs to be introduced, which is given by the ML model execution ID, which then distinguishes executions of the same ML model. This is helpful not only for the case of one requesting application, but also for distinguishing execution requests from multiple applications.
[0013] In another preferred aspect of the method, the method may further include receiving ML model information from at least one ML application, the ML model information including at least an ML model definition and ML model metadata, the ML model metadata including information specifying an ML runtime for executing the ML model; generating an ML model runner instance for the model information, the model runner instance being configured to interact with the ML runtime to enable the ML runtime to execute the ML model. The ML model definition includes at least a graph definition and weights of the ML model.
[0014] In another preferred aspect of the method, the method may further include receiving an uninstall request. The uninstall request may cancel initialization of the loaded ML model and release corresponding resources allocated to the corresponding ML model. The resources may include at least one of the following: core resources, memory resources, or corresponding IDs associated with the ML model.
[0015] Although various aspects of the method are described in various paragraphs, it should be contemplated that all aspects of the method are combinable, and no aspect excludes other aspects. Thus, the various aspects described herein may be combined individually or together with the general aspects of the method described.
[0016] The above-mentioned need for improved data processing using ML models is also met by a computer program product comprising computer-readable instructions which, when executed by a computer, cause the computer to perform the described method.
[0017] In addition, the need is also met by a computing device for processing data using an ML model according to the present invention. The computing device includes a memory storing computer-readable instructions and an ML controller, the ML controller being configured to receive at least one request to run at least one ML model from at least one ML application, queue pre-processed input data for the at least one ML model, and run the at least one ML model using an ML runtime, wherein running the at least one ML model includes: executing the at least one ML model by the ML runtime; and starting to process a second set of queued input data using the at least one ML model independently of post-processing output data generated by processing a first set of queued input data.
[0018] In one aspect of the computing device, the ML controller includes: an agent function for receiving at least one request and pre-processed input data; and a listener function for monitoring output data and outputting an indication to at least one ML application once execution of at least one ML model has produced the output data.
[0019] In another aspect of the computing device, at least one ML application and a target ML platform are embedded within the computing device, and at least one ML model is executed by a ML controller on the target ML platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Various aspects of the present disclosure are described in more detail below with reference to the accompanying drawings, but the present disclosure is not limited to the embodiments of these drawings. In the accompanying drawings, similar components or features may have the same reference numerals. In addition, various components of the same type can be distinguished by letters attached to the reference numerals. If only reference numerals are used in the specification, the description applies to any similar component with the same first reference numeral, regardless of the attached letters.
[0021] Figure 1 A schematic diagram of a system for synchronizing ML model execution according to the prior art is shown;
[0022] Figure 2 Shown by Figure 1 A time graph of the execution of the ML model executed by the system shown;
[0023] Figure 3 A schematic diagram of a system for enabling asynchronous ML model execution caused by an application according to the present invention is shown;
[0024] Figure 4 Shown by Figure 3 A time graph of the execution of the ML model executed by the system shown;
[0025] Figure 5 A schematic diagram of a system for enabling asynchronous ML model execution caused by multiple applications according to the present invention is shown;
[0026] Figure 6 Shown by Figure 5 A time graph of the execution of the ML model executed by the system shown;
[0027] Figure 7 A flowchart of a method for asynchronous ML model execution is shown;
[0028] Figure 8 A schematic diagram showing a system for enabling asynchronous ML model execution according to the present invention; and
[0029] Fig. 9 Shows Figure 8 Schematic diagram of the data flow within the system shown. DETAILED DESCRIPTION
[0030] Aspects of the present disclosure are provided in the following description and related drawings for various examples provided for illustrative purposes. Alternative aspects may be designed without departing from the scope of the present disclosure. In addition, well-known elements of the present disclosure will not be described in detail or will be omitted to avoid blurring the relevant details of the present disclosure. It should be understood that various changes may be made to the function and arrangement of the elements without departing from the scope of the present application set forth in the appended claims.
[0031] Figure 1 A schematic diagram of a system 100 for synchronizing ML model execution according to the prior art is shown. The system 100 depicted here includes a data source 110, which provides data to an application 120. The data source 110 may be a sensor, such as a camera or a radar system.
[0032] The application 120 includes a pre-processing function 130 and a post-processing function 160. The pre-processing function 130 of the application 120 processes the incoming data. Pre-processing may include adjusting the raw input data from the data source 110 to a format for training the ML model. However, those skilled in the art will recognize that other pre-processing may also be performed. For example, in the case where the input data comes from a camera, the pre-processing may cover at least one of the following items: image resizing, image cropping, image quality improvement (such as contrast, illumination, sharpness), or a combination thereof. Therefore, it can be appreciated that pre-processing may be very specific and customized to the data source 110 from which the data originates. Once the pre-processing function 130 has pre-processed the data, the application 120 presents the data to the ML controller 140 together with some additional information for executing the ML model. The additional information may include an ML model definition and metadata. Thus, the ML model definition may take the form of a graph definition file, which contains a model architecture and parameters (i.e., trained weights). The metadata may include information specifying the type of processing resources used to execute the ML model, scheduling information for the ML model, and / or information specifying the ML runtime for executing the ML model. The metadata may also include, but is not limited to, one or all of the following details about the ML model: the path to the model definition file, the name of the specific ML runtime to be used to execute the ML model, the processor core type on which the ML model is to be executed, profiling information of the ML model for one or more processor core types, the memory requirements of the ML model (i.e., memory for model parameters and runtime memory), the priority of the ML model, and the power or energy requirements of the ML model. However, it is also contemplated that the application 120 and in particular the pre-processing function 130 present only pre-processed data to the ML controller 140, such as in the case where the ML model is already loaded and ready to execute, so that only data needs to be provided. The provision of data to the ML controller 140 is indicated by a black rectangle with a number "1" therein to indicate that a data set is provided to the ML controller 140.
[0033] The ML controller 140 then uses the input data and, if provided with any additional information, selects an appropriate ML runtime environment and ML model and executes the ML model on the ML accelerator 150. The ML accelerator 150 may encompass the core on which the ML runtime environment and the runtime execute the ML model. Here again, the passing of the first set of data to the ML accelerator 150 is indicated by a black rectangle with a number “1” therein. It will then take some time until the ML model produces some output data. The output data is indicated by a black rectangle with a number “1′” therein. The output data is passed from the ML accelerator 150 to the ML controller 140 and from there to the post-processing function 160 of the application 120. The post-processing performed by the post-processing function 160 may, for example, include, in the case where the input data originates from a camera, extracting classification results for objects in the image, extracting bounding boxes, etc. It is also contemplated here that the post-processing may be specific to the input data or the data source from which the data originates. Furthermore, it is also clear that the post-processing depends on what should be done further with the output data.
[0034] Figure 1 A disadvantage of the depicted system 100 is that the ML model is executed in a synchronous manner, which means that the pre-processing function 130 waits for the ML model to process the input data, and sometimes even for the post-processing function 160 to process the input data, until new input data is ready to be provided to the ML controller 140. It can also be said that the application 120 is blocked from performing further pre-processing until the output data appears and is post-processed. Therefore, time that could be better utilized is wasted, Figure 2 The time waste of prior art methods is highlighted in FIG.
[0035] Figure 2 It is shown that Figure 1 A time diagram 200 of a synchronous ML model execution performed by the system 100 is shown. Thus, the time diagram 200 shows a schematic time progression of data through the application 120 and the ML controller 140. Time progresses in a manner starting from the top of the diagram and moving toward the bottom.
[0036] First, the application 120 starts by pre-processing the first input data received from the data source using the pre-processing function 130. This already takes a certain amount of time. Once the pre-processing is complete, the data is provided 210 to the ML controller 140. The data is again highlighted with a black rectangle with a number "1" therein. Once the data is received, the ML controller 140 starts ML model execution 220. The time when the ML model is executed is indicated by the bars. During the execution of the ML model, the ML controller uses the ML runtime of the ML accelerator 150. The inference of the ML model will take some time, which is indicated by the rectangle along the time axis of the ML controller 140. At the end of the inference of the ML model, the output data is provided 230 from the ML accelerator 150 to the ML controller. The output data is indicated by a black rectangle with a number "1'" therein. The output data is then provided 240 to the application. Once the output data is received 250 by the application 120, it is provided to the post-processing function 160 to post-process the output data.
[0037] After post-processing of the output data occurs, the application 120 (more specifically, the pre-processing function 130) begins again by pre-processing the second input data, which is indicated by the black rectangle with the number "2" therein. This pre-processed input data is then provided 210a to the ML controller 140, which runs 230a the ML model using the corresponding input data and then provides 240a the output data to the application 120. Once the output data is received 250a, the application 120 begins post-processing using the post-processing function 160. This process begins over and over again until the input data is processed.
[0038] from Figure 2 It can be seen from the above that the system according to the prior art wastes time because the application is blocked after preprocessing the first data until the output data generated by the first input data is post-processed. It can also be said that the application 120 is idle at least with respect to the preprocessing function 130. This time is denoted by “t wait " indication. It can also be said that the prior art system processes the input data synchronously, because new pre-processing is not triggered until the output of the previous input data is post-processed.
[0039] The method, computer program product and device according to the present application overcome this time waste in the prior art. More details are presented in the following figures.
[0040] Figure 3 3 shows a schematic diagram of a system 300 according to the present invention, which is used to enable asynchronous ML model execution caused by an application 320. The system 300 includes Figure 1The system depicted has similar components, namely, data source 310 , application 320 , pre-processing function 330 , post-processing function 360 , ML controller 340 , and ML accelerator 350 .
[0041] However, in the system 300, the ML controller 340 additionally includes an ML interface 341, which includes at least one queue 342. The queue 342 allows the pre-processing function 330 to continuously provide pre-processed input data to the ML controller 340 without waiting. The pre-processed input data is indicated by black rectangles with numbers "1", "2" and "3" therein. The ML controller 340 can then provide the input data from the queue 342 to the ML model. Although in the embodiment example shown here, only one queue 342 is shown, it is conceivable to maintain several queues, for example, one queue for each different ML model to be executed. The ML controller 340 can then use the queued input data to input to the corresponding ML model, for example on a first come first serve basis.
[0042] and Figure 1 Compared with Figure 3 As can be seen in FIG, the new functionality can be provided only in the ML interface 341, which also allows it to be used with a conventional ML controller, which then only needs to be connected to the functionality of the ML interface 341 without being modified. In this case, instead of the pre-processing functionality 330, the ML interface 341 provides input data to the conventional ML controller. This reduces the need to completely redesign the ML controller. However, for further explanation, it is assumed that the ML interface 341 is part of the ML controller 340 and is not separate from it, but this should not be seen as limiting.
[0043] Figure 4 The temporal progression of input data through the application 320 and the ML controller 340 is schematically depicted.
[0044] Figure 4 It is shown that Figure 3 A time diagram 400 of an asynchronous ML model execution performed by the system 300 is shown. Thus, the time diagram 400 shows an illustrative time progression of data through the application 320 and the ML controller 340. Time progresses in a manner starting from the top of the diagram and moving to the bottom.
[0045] First, the application 320 starts by preprocessing the first input data received from a data source (not shown here) using the preprocessing function 330. Once the preprocessing is complete, the data is provided 410a to the ML controller 340. The data is again highlighted with a black rectangle with the number "1" therein. Once the data is received, the ML controller 340 starts the ML model execution 430a. The application 320 does not wait for the ML model output, but directly starts preprocessing the second input data, which is highlighted with a black rectangle with the number "2" therein. Once the preprocessing of the second input data using the preprocessing function 330 is completed, the input data is provided to the ML controller 340. The second preprocessed input data is then stored in the queue 342 of the ML interface 341, pending for use in the ML model execution.
[0046] In the example shown here, the ML controller 340 has completed processing the first input data after queuing the second input data and provides 440a first output data to the application 320, which is received 450a and can then be post-processed using the post-processing function 360. The output data is indicated by a black rectangle with a number "1'" therein. Immediately after post-processing or already during post-processing, the application 320 can pre-process the third input data, which is indicated by a black rectangle with a number "3" therein. The pre-processed third input data can then be provided 410c to the ML controller 340, where they can be stored in the queue 342 until used for ML model execution 430c. The ML controller 340 will then take the input data from the queue and feed the corresponding input data to the ML model.
[0047] In the embodiment example shown here, the ML controller 340 then provides 440b, 440c output data of the second input data, followed by output data of the third input data, to the application 320. The respective output data are indicated by black rectangles with the numbers "2" and "3", respectively. Once the output data are received 450b, 450c by the application 320, the post-processing function 360 can post-process the respective output data.
[0048] As is evident from the timing diagram 400, the pre-processing functionality 330 is decoupled from the post-processing functionality 360. This is achieved through the ML interface 341 which provides a way for applications to interact with the ML controller 340 in a manner that allows a constant flow of input data to the ML controller 340 without any unnecessary waiting times, such as Figure 2 The situation in the prior art shown.
[0049] Obviously, this new decoupled aspect of pre-processing and post-processing applies not only to the execution of ML models requested by the same application, but also to the execution of ML models requested from different applications. Figure 5 and Figure 6 Described in .
[0050] Figure 5 Schematic diagram of a system 500 for enabling asynchronous ML model execution caused by multiple applications 520a to 520n according to the present invention is shown. The system 500 includes Figure 3 Components similar to the system described above, namely, data source 510, applications 520a to 520n, ML controller 540, and ML accelerator 550. Each of the applications 520a to 520n may include pre-processing functions 530a to 530n and post-processing functions 560a to 560n. Each of the pre-processing functions 530a to 530n may provide input data to the ML controller 540. Figure 3 As already shown in the context of , the ML controller 540 may include an ML interface 541 that encompasses a queue 542 into which input data from a plurality of applications 520a to 520n may be stored. Although in the implementation example shown here, only one queue 542 is shown, it is conceivable that several queues may be maintained, for example, one queue for each different application 520a to 520n, or even further one queue for each ML model to be executed. The ML controller 540 may then use the queued input data for input to the respective ML model, for example on a first-come, first-served basis. Once the ML model has generated an output, the ML controller 540 may provide the output data to the respective applications 520a to 520b for post-processing by their respective post-processing functions 560a to 560n. The temporal progression of the data is shown in FIG. Figure 6 Shown in.
[0051] Figure 6 It is shown that Figure 5 A time diagram 600 of an asynchronous ML model execution performed by the system 500 is shown. Thus, the time diagram 600 shows an illustrative time progression of data through the applications 520a to 520n and the ML controller 540. Time progresses in a manner starting from the top of the diagram and moving to the bottom.
[0052] In the implementation example shown here, the applications 520a and 520b first start by preprocessing the input data using their respective preprocessing functions 530a and 530b. Although shown here in a sequential time sequence, it is conceivable that the two applications can also work in parallel and provide input data to the ML controller 540 at the same time. Both applications 520a and 520b provide 610a, 610b their preprocessed input data to the ML controller 540. There, the preprocessed input data is stored in a queue 542 of the ML interface 541 for use in the ML model executions 630a and 630b.
[0053] In the implementation example shown here, first input data originating from application 520a first produces output that is provided 640a to application 520a. Once the output data is received 650a at application 520a, the output data is post-processed using post-processing functionality 560a.
[0054] In the implementation example shown here, while application 520a has performed post-processing on output data generated by the first input data, application 520n performs pre-processing on the third input data. Application 520n then provides 610n the pre-processed input data to ML controller 540, where they are queued and then used for ML model execution 630n.
[0055] The second input data and the third input data then also generate output data, which are then provided 640b and 640n to the respective applications 520b and 520n from which the corresponding input data originated. Once the output data is received 650b and 650n at the applications 520b and 520n, the output data is post-processed using the respective post-processing functions 560b and 560n of the applications 520b and 520n, respectively.
[0056] Also here, you can see that pre-processing and post-processing are decoupled and that the interface in the ML controller allows for asynchronous execution of ML models.
[0057] from Figure 4 and Figure 6 As is evident from the above, input data can originate from one application or multiple applications, and ML controllers can run the same or different ML models, so there must be a way to associate the corresponding input data with the ML model and the application requesting to run the ML model. Figure 7 How this is done is described in more detail in the context of .
[0058] Figure 7 A flowchart of a method 700 for asynchronous ML model execution is shown. The method may be performed, for example, by Figure 3 and Figure 5, and the ML controller 340 or 540 shown in . The method starts at step 710 with receiving at least one request to run at least one ML model from at least one ML application at the ML controller. The run request may include an ML model loading request 711 and an ML model execution request 712, with the ML model loading request being used to initialize the ML model and the ML model execution request being used to execute the ML model. Executing the ML model means using the ML model to process input data, thereby generating output data. As described above, executing the ML model may also be referred to as performing reasoning of the ML model. In the context of the present application, it is contemplated that the run request can cover both the ML loading request 711 and the ML execution request 712. Thus, it is also contemplated that the ML loading request 711 and the ML execution request 712 may be received by the ML controller at the same time or at different times, depending on the implementation of the application. It should also be contemplated that the ML loading request 711 and the ML execution request 712 are completely decoupled in time, but this should still be regarded as a run request in the meaning of the present application.
[0059] In order to distinguish different ML models, the run request (e.g., ML load request 711) may include an ML model reference ID 711a. The ML model reference ID may be a unique ID given to each ML model. The ML model reference ID 711a may thus be generated by the application and provided to the ML controller. The run request (e.g., ML execution request 712) may also include at least one of an ML model instance ID 712a or an ML model execution ID 712b. The ML model instance ID 712a identifies the ML model runner instance to be used. If there is ambiguity about the ML model runner instance, such as an application wants to use the same ML model runner instance but with different inputs, the ML model execution ID may be used. In this case, the ML execution request 712 may also include an ML model execution ID 712b, with which different executions of the same ML model can be distinguished.
[0060] After the ML controller receives the run request in step 710, the method proceeds to queue the incoming pre-processed input data in step 720. Thus, the input data may have been provided together with the run request in step 710 or may be received separately after the run request. It is also conceivable that after receiving the run request in step 710, the ML controller allocates memory for the corresponding queue of input data to be used with the ML model, and then either receives the corresponding input data and stores it in the corresponding memory, or provides the memory address to the application so that the application can store the input data itself at the corresponding memory address.
[0061] Once the model run request is received in step 710 and the input data is queued in step 720, the method proceeds to step 730, which covers running the ML model. Thus, the running covers the execution of the ML model. As described above, running or executing the ML model means that the input data is processed by the ML model. In this way, the step 730 of running the ML model also includes processing the input data using the corresponding ML model 731, 732. Thus, because the ML controller according to the present invention works in a manner decoupled from the pre-processing and post-processing of the application, the processing includes starting the processing of the second set of queued input data using at least one ML model 732, which is independent of the post-processing of the output data generated by the first set of queued input data in processing 731. In other words, the ML controller according to the present invention allows the input data to be processed in an asynchronous manner, which overcomes the disadvantages of synchronous processing, in which the application will be blocked until the ML model generates output data and the output data has been post-processed. For example, this allows the application to use the time that would otherwise be wasted to pre-process new input data so that new input data can be continuously provided to the ML controller.
[0062] The method 700 also includes the step of providing 740 the output data to a post-processing function of the application. This providing 740 of the output data can be performed by sending the output data to the application or by a callback function that simply notifies the application that the requested ML model run has produced output data and that the output data can be retrieved.
[0063] A more detailed view of the inner workings of the ML controller and the data flow within the ML controller is given in Figure 8 and Fig. 9 Depicted in.
[0064] Figure 8A schematic diagram of a system 800 for enabling asynchronous ML model execution according to the present invention is shown. The system 800 includes an ML controller 840 as a main component. The ML controller 840 includes an ML interface 841, which provides an interface to applications 820a to 820n that interact with the ML controller 840. The ML interface 841 thereby provides input data and output data exchange with the applications 820a to 820n. The ML interface 841 includes at least one queue 842 into which incoming input data can be stored. Thus, the ML interface 841 includes a proxy function 843 and a listener function 844. The proxy function 843 is used to receive ML model execution requests from applications 820a to 820n. Thus, these requests may already include input data 822a to 822n and information about the ML model to be run. The information may include ML model definitions 821a to 821n, and in some cases also include at least one ID 823a to 823n, which may take the form of an ML model reference ID, an ML model instance ID, and / or an ML model execution ID. The proxy function 843 then stores the input data in the queue 842 and instructs the ML controller 840 to perform the corresponding ML model execution. The ML interface 841 also includes a listener function 844. The listener function 844 monitors the ML model execution, and in particular monitors the resulting output data of any ML model execution. Once the listener function 844 recognizes that the ML model execution has produced output data, the listener function indicates this to the corresponding application 820a to 820n that provides the corresponding request and input data. In the embodiment example shown here, the ML interface 841 is part of the ML controller 840. However, it should be understood that the ML interface 841 can also be provided as a stand-alone software, which can be used as a supplement to existing ML controllers to enable them to perform asynchronous ML model execution. For this purpose, the ML interface 841 can include or be equipped with all necessary libraries and APIs to connect with the corresponding ML controller.
[0065] In the example implementation shown here, in addition to the ML model definitions 821a to 821n, input data 822a to 822n, and IDs 823a to 823n, multiple applications 820a to 820n may provide additional information to the ML controller 840. The additional information may include metadata that provides relevant information to the ML controller 840 to enable the generation of an ML runner instance and the subsequent execution of the ML model. The metadata may include, but is not limited to, the following detailed information about the ML model: the path of the model definition file, the name of the specific ML runtime to be used to execute the ML model, the processor core type on which the ML model is to be executed, analysis information of the ML model for one or more processor core types, the memory requirements of the ML model (i.e., memory for model parameters and runtime memory), the priority of the ML model, and the power or energy requirements of the ML model.
[0066] Using the information provided to the ML controller 840, the ML controller executes the specified ML model. Thus, the ML controller 840 shown here includes a model runner instance generator 850, an ML workload monitor 860, and an ML model scheduler 865.
[0067] The model runner instance generator 850 is configured to create an ML model runner instance 871 to interact with a specified ML runtime 881 in the available ML runtime 880 specified by the corresponding application 820a to 820n requesting the ML model run. In order to create the model runner instance, the model runner instance generator 850 can access one or more API libraries containing API information for a specific ML runtime. An API library can be provided for each of the supported ML runtimes 881. By using the API information, the ML runner instance can interact with the ML runtime 881 according to the API of the ML runtime 881. In other words, the runner instance acts as an interface between the ML controller 840 and the ML runtime 880. There can be as many ML runner instances as required as the memory budget allows. The ML model runner instance is associated with the corresponding ML model instance ID generated by the ML controller 840 and given to the application 820a to 820n, so that the application 820a to 820n can use the corresponding ML model instance ID in their ML model execution request to identify the ML model to be executed.
[0068] The ML workload monitor 860 is a module responsible for tracking the hardware platform resource usage of the ML model. The monitoring performed by the ML workload monitor 860 may involve monitoring the usage of the execution cores 890 (ML processing resources) and / or memory usage. Other system parameters may also be monitored, such as power or bandwidth consumption. It should be understood that any system parameter that indicates the resource usage of the system may be monitored. For example, as described above, there may be as many ML runner instances 871 as required by the application 820a to 820n as the memory budget allows. As such, the ML workload monitor 860 may also be configured to track current memory usage.
[0069] The information obtained by the ML workload monitor 860 can be output to the ML model scheduler 865 to help with scheduling decisions. In addition, the information can be output to the user via a user interface (not shown) so that developers can understand the workload being deployed.
[0070] The ML model scheduler 865 is a module responsible for orchestrating the platform resource usage of ML models. The scheduling decisions taken by the ML model scheduler 865 can be based on the metadata of the ML models provided by the requesting applications 820a to 820n.
[0071] The ML controller 840 is configured to target highly heterogeneous platforms with multiple ML runtimes 880 and execution core types 890. In general, the ML controller 840 and its abstraction layer 870 allow applications 820a to 820n to work with any ML runtime 881, including open source (such as but not limited to Tensorflow, TFLite, TVM) or proprietary solutions. The open source and proprietary ML runtimes mentioned are just examples, and the embodiments provide interfaces with the ML runtime 880 in a generic manner with the help of the abstraction layer 870. In other words, the system is not bound to any specific ML runtime. In terms of processing cores 890, the ML controller 840 is also not limited to a specific type. The ML controller 840 can use processing resources including CPU 891, GPU 892, DSP 893 and / or NPU 894 or other core types.
[0072] Figure 8 The data flow and component interactions described in Fig. 9 Detailed description is given in .
[0073] Fig. 9 It shows that Figure 8 Schematic diagram of data flow within the system shown. For the purpose of better illustration, only one application 920 is depicted. However, this should not be construed as limiting, and multiple applications may also exist, such as Figure 8 The situation in.
[0074] The application 920 may request the ML model to process the input data. The application 920 may send the request to the ML interface 941 as described above. For example, the application 920 may first send an ML model loading request to the ML controller 940. The ML model loading request may include an ML model reference ID that can distinguish the ML model. Based on the ML loading request, the model runner instance generator 950 will create an ML runner instance 971. The ML controller associates the ML runner instance 971 with the ML model instance ID to allow different ML runner instances to be distinguished. The ML controller then returns the ML model instance ID to the application together with the initial ML model reference ID, so that the application knows that the corresponding ML runner instance 971 for the corresponding requested ML model has been created. The application 920 may then send an ML execution request to the ML controller, in which the application 920 specifies the ML runner instance 971 to be used by the ML model instance ID. If the same ML runner instance is to be used with different inputs (e.g., inputs from different data sources), the application 920 may include an ML model execution ID in the ML execution request in addition to the ML model instance ID to also distinguish different executions of the same ML model.
[0075] As part of or separate from a run request, the application 920 may provide input data from its pre-processing function 930 to the ML interface 941. More specifically, the input data is provided to a proxy function 943 of the ML interface 941. The input data is then queued in a queue 942 of the ML interface 941. Although only one queue 942 is shown here, it is contemplated that multiple queues may be used, such as one queue for each ML model to be executed.
[0076] The input data for the ML model is forwarded to the ML runner instance 971 and then provided to the corresponding ML runtime 980 for processing. As shown here, the input to the ML runner instance 971 comes from the queue 942 of the ML interface 941. This means that the provision of input data is decoupled from the pre-processing function 930 of the application 920. This in turn means that the application 920 can continuously provide new input data for the ML model to the ML interface 941 without being blocked until the execution of the ML model with one set of input data is completed.
[0077] Once the ML runner instance 971 generates output data, the listener function 944 of the ML interface 940 will be notified that the output data is ready, or the listener function 944 itself will monitor the ML runner instance 971 and identify when the output data is ready. The listener function 944 will then notify the requesting application 920 or the post-processing function 960 that the output data is available so that the output data can be retrieved by the post-processing function 960. It should also be envisioned that the listener function 944 receives the output data from the ML runner instance 971 and then provides it to the post-processing function 960. Obviously, the provision of output data to the post-processing function 960 is decoupled from the input data provided by the pre-processing function 930. This decoupling is achieved through the functionality of the ML interface 941, which promotes the temporal decoupling of pre-processing and post-processing due to the queuing of the pre-processed input data. The listener function 944 can use one or all of the above-mentioned IDs to associate the output data with the corresponding request and notify the application 920 accordingly.
[0078] Although the system described throughout the application includes certain components, it will be appreciated by those of ordinary skill that the system may include more components than those shown. These components may include software, hardware, or one or more combinations of software and hardware. For example, in some implementations, the components of the system may include and / or may be implemented using electronic circuits or other electronic hardware, which may include one or more programmable electronic circuits, and / or may include and / or be implemented using computer software, firmware, or any combination thereof that performs the various operations described herein. The software and / or firmware may include one or more instructions stored on a computer-readable storage medium and executable by one or more processors of an electronic device that implements the corresponding operations.
[0079] It is to be understood that the claims are not limited to the precise configuration and components shown above. Various modifications, changes and variations may be made in the arrangement, operation and details of the systems, methods, and apparatus described herein without departing from the scope of the claims.
Claims
1. A method for processing data using a machine learning (ML) model, the method comprising the following steps: receiving (710) at a ML controller (340, 540, 840, 940) at least one request from at least one ML application (320, 520, 820, 920) to run at least one ML model; queuing (720) pre-processed input data for the at least one ML model at the ML controller (340, 540, 840, 940); The at least one ML model is run (730) by the ML controller (340, 540, 840, 940) using an ML runtime, wherein the running comprises: executing, by the ML runtime, the at least one ML model; Independent of post-processing the output data generated by processing (731) the first set of queued input data, processing (732) the second set of queued input data using the at least one ML model begins.
2. The method according to claim 1, wherein: The at least one request includes an ML model reference ID ( 711a ) for distinguishing the ML model.
3. The method according to claim 2, wherein: At least two requests are received, wherein the at least two requests are received from the same ML application (320, 520, 820, 920) and the at least two requests are related to different ML models.
4. The method according to any one of the preceding claims, further comprising: An ML model instance ID for distinguishing different ML instances is generated ( 712 a ).
5. A method according to any one of the preceding claims, wherein: The at least one request includes an ML model execution ID ( 712b ) for distinguishing the execution.
6. The method according to claim 5, wherein: At least two requests are received and the at least two requests are related to a same ML model.
7. The method according to any one of claims 2 to 6, wherein: At least one of the ML model reference ID ( 711a ), the ML model instance ID ( 712a ), or the ML model execution ID ( 712b ) is used to associate a set of queued input data with an execution of a corresponding ML model.
8. A method according to any one of the preceding claims, wherein: The method further comprises: Once execution of the ML model has produced output data, an indication is output (740) to the at least one ML application (320, 520, 820, 920).
9. A method according to any one of the preceding claims, wherein: The step of receiving (710) at least one request comprises: receiving at least one load request, the at least one load request initializing the at least one ML model; and At least one execution request is received, the at least one execution request causing the at least one ML model to be executed.
10. The method according to any one of the preceding claims, further comprising: receiving ML model information from the at least one ML application, the ML model information comprising at least an ML model definition and ML model metadata, the ML model metadata comprising information specifying the ML runtime that executes the ML model; An ML instance is generated, the ML instance being configured to interact with the ML runtime to cause the ML runtime to execute the ML model.
11. The method according to claim 10, wherein: The ML model definition includes at least a graph definition and weights of the ML model.
12. A computer program product, comprising computer-readable instructions, which, when executed by a computer, cause the computer to perform the method according to any one of claims 1 to 11.
13. A computing device for processing data using a machine learning (ML) model, the computing device comprising: a memory storing computer-readable instructions; as well as An ML controller (340, 540, 840, 940), wherein the ML controller is configured to: receiving at least one request to run at least one ML model from at least one ML application (320, 520, 820, 920); queuing preprocessed input data for the at least one ML model; The at least one ML model is run using an ML runtime, wherein running the at least one ML models include: executing, by the ML runtime, the at least one ML model; Independently of post-processing the output data produced by processing the first set of queued input data, Processing the second set of queued input data using the at least one ML model begins.
14. The computing device of claim 13, wherein: The ML controller (340, 540, 840, 940) comprises: a proxy function for receiving the at least one request and the pre-processed input data; and A listener function for monitoring the output data and outputting an indication to the at least one ML application once execution of the at least one ML model has produced the output data.
15. The computing device according to claim 13 or 14, wherein: The at least one ML application (320, 520, 820, 920) and a target ML platform are embedded in the computing device, and the at least one ML model is executed by the ML controller (340, 540, 840, 940) on the target ML platform.
