Model environment parameter optimization method and device, medium and program product
By performing the parameter optimization process after model deployment, updating the model environment parameters and using temperature coefficient optimization, the problem of low efficiency of environmental configuration parameters after model deployment is solved, and an efficient global optimal solution is achieved.
Patent Information
- Application Number
- CN202510331672.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-03-20
AI Technical Summary
The environmental configuration parameter tuning process after the model is deployed has the problem of long optimization time, low efficiency, and the debugging process occupies a large amount of computing resources.
By performing the parameter optimization process, the current temperature coefficient, model environment parameters, performance parameters and fitness are obtained, the model environment parameters are updated until the termination conditions are met, and the temperature coefficient is adjusted using the cooling factor to optimize the parameters.
The efficiency of model environment parameter optimization is improved, the global optimal solution is obtained, and the problem of manual debugging is long and low efficiency is solved.
Smart Images

Figure CN119849643A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a model environment parameter optimization method, device, medium and program product. Background Art
[0002] In recent years, with the rapid development of artificial intelligence models in multiple fields such as image recognition, speech processing, and natural language processing, the scale and complexity of models have continued to increase. How to improve the reasoning efficiency and performance of artificial intelligence models and effectively exert the reasoning ability of artificial intelligence models has become a key challenge. Reasoning is the core link for artificial intelligence models to perform tasks such as prediction, classification, or generation based on actual data. Since artificial intelligence models are deployed on specific hardware devices, their reasoning performance is restricted by the deployment environment. If the deployment environment is not configured reasonably, it is difficult to exert the good reasoning effect of the model. Therefore, after the model is deployed, it is necessary to tune the parameters of its deployment environment to maximize the reasoning performance of the model. The debugging of the deployment environment usually relies on personal experience and is performed manually. This method is time-consuming, inefficient, and occupies a large amount of computing resources. It is difficult to obtain the global optimal deployment environment parameters. Summary of the invention
[0003] The present application provides a model environment parameter optimization method, device, medium and program product, which at least solves the problems of long optimization time, low efficiency and large computing power resource occupation in the environment configuration parameter tuning process after model deployment.
[0004] In a first aspect, the present application provides a method for optimizing model environment parameters, comprising: Obtaining a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; The parameter optimization process is executed until the termination condition is met, wherein the parameter optimization process includes: Determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; Determine the fitness difference based on the new fitness and the current fitness; Update the current model environment parameters according to the fitness difference; In response to the updated current model environment parameters satisfying the termination condition, outputting the current model environment parameters; In response to the updated current model environment parameter not satisfying the termination condition, the current temperature coefficient is updated with the current temperature coefficient and the cooling factor, and the parameter optimization process is repeated, wherein the cooling factor represents the decrease range of the current temperature coefficient.
[0005] In a second aspect, the present application also provides a model environment parameter optimization device, comprising: A parameter acquisition module, used to acquire a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; The parameter optimization module is used to execute the parameter optimization process until the termination condition is met, wherein the parameter optimization process includes: A new solution calculation unit, used to determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; A difference calculation unit, used for determining a fitness difference according to the new fitness and the current fitness; A parameter updating unit, used to update the current model environment parameters according to the fitness difference; A result output unit, configured to output the current model environment parameters in response to the updated current model environment parameters satisfying the termination condition; The coefficient updating unit is used to update the current temperature coefficient with the current temperature coefficient and the cooling factor in response to the updated current model environment parameter not satisfying the termination condition, and repeat the parameter optimization process, wherein the cooling factor represents the decrease range of the current temperature coefficient.
[0006] In a third aspect, the present application further provides a computer device, including a memory, a processor, and a model environment parameter optimization program stored in the memory and executable on the processor. When the processor executes the model environment parameter optimization program, the model environment parameter optimization method described in the first aspect is implemented. Specifically, it includes: Obtaining a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; The parameter optimization process is executed until the termination condition is met, wherein the parameter optimization process includes: Determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; Determine the fitness difference based on the new fitness and the current fitness; Update the current model environment parameters according to the fitness difference; In response to the updated current model environment parameters satisfying the termination condition, outputting the current model environment parameters; In response to the updated current model environment parameter not satisfying the termination condition, the current temperature coefficient is updated with the current temperature coefficient and the cooling factor, and the parameter optimization process is repeated, wherein the cooling factor represents the decrease range of the current temperature coefficient.
[0007] In a fourth aspect, the present application further provides a computer-readable storage medium on which a model environment parameter optimization program is stored. When the model environment parameter optimization program is executed by a processor, the model environment parameter optimization method recorded in the first aspect is implemented. Specifically, it includes: Obtaining a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; The parameter optimization process is executed until the termination condition is met, wherein the parameter optimization process includes: Determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; Determine the fitness difference based on the new fitness and the current fitness; Update the current model environment parameters according to the fitness difference; In response to the updated current model environment parameters satisfying the termination condition, outputting the current model environment parameters; In response to the updated current model environment parameter not satisfying the termination condition, the current temperature coefficient is updated with the current temperature coefficient and the cooling factor, and the parameter optimization process is repeated, wherein the cooling factor represents the decrease range of the current temperature coefficient.
[0008] In a fifth aspect, the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the model environment parameter optimization method described in the first aspect. Specifically, it includes: Obtaining a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; The parameter optimization process is executed until the termination condition is met, wherein the parameter optimization process includes: Determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; Determine the fitness difference based on the new fitness and the current fitness; Update the current model environment parameters according to the fitness difference; In response to the updated current model environment parameters satisfying the termination condition, outputting the current model environment parameters; In response to the updated current model environment parameter not satisfying the termination condition, the current temperature coefficient is updated with the current temperature coefficient and the cooling factor, and the parameter optimization process is repeated, wherein the cooling factor represents the decrease range of the current temperature coefficient.
[0009] The beneficial effects of the technical solution provided by the embodiment of the present application are: By implementing a model environment parameter optimization method, device, medium and program product provided in the embodiment of the present application, the efficiency of model environment parameter optimization can be improved by executing the parameter optimization process, and the global optimal solution can be obtained. The problem that manual debugging of environment parameters is time-consuming, inefficient and difficult to obtain the global optimal solution is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 It is a schematic diagram of a model environment parameter optimization method provided in an embodiment of the present application; Figure 2 It is a schematic diagram of a model environment parameter optimization device provided in an embodiment of the present application; Figure 3 It is a schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0012] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the implementation mode of this application will be clearly and completely described below in conjunction with the drawings in the implementation mode of this application. Obviously, the described implementation mode is only a part of the embodiments of this application, not all embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0013] Unless otherwise defined, the technical terms or scientific terms used in the present disclosure shall have the usual meanings understood by persons with ordinary skills in the field to which the present disclosure belongs. The words "first", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "one", "one" or "the" do not indicate a quantity limitation, but indicate that there is at least one. The numbers in the drawings of the specification only indicate the distinction between various functional components or modules, and do not indicate the logical relationship between components or modules. Words such as "include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0014] Hereinafter, various embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. It should be noted that in the accompanying drawings, the same reference numerals are given to components having substantially the same or similar structures and functions, and repeated descriptions thereof will be omitted.
[0015] In view of the problems in the prior art that the environment configuration parameters after model deployment have long optimization time, low efficiency, and the debugging process occupies a large amount of computing resources during adjustment, this application provides the following implementation methods.
[0016] In some embodiments, Figure 1 As shown, a model environment parameter optimization method includes: S100: obtaining a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; S200: Execute a parameter optimization process until a termination condition is met, wherein the parameter optimization process includes: S210: Determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; S220: determining a fitness difference according to the new fitness and the current fitness; S230: updating the current model environment parameters according to the fitness difference; S240a: In response to the updated current model environment parameters satisfying the termination condition, outputting the current model environment parameters; S240b: In response to the updated current model environment parameter not satisfying the termination condition, the current temperature coefficient is updated with the current temperature coefficient and the cooling factor, and the parameter optimization process is repeated, wherein the cooling factor represents the decrease amplitude of the current temperature coefficient.
[0017] When the model performs reasoning tasks, its operating environment needs to be configured. The model environment parameters include at least one of the following: batch size, number of replication streams, number of reasoning streams, whether to reason on replication streams, and whether to use graph optimization.
[0018] Among them, the batch size (batchsize) determines the number of inferences each time, and the value range is 256 to 2560; the number of copy streams (copy_streams) controls the number of concurrent streams during inference, and the value range is 1 to 10; the number of inference streams (infer_streams) determines the number of inference threads running simultaneously, and the value range is 1 to 10; whether to infer on the copy stream (run_infer_on_copy_streams) indicates whether to run inference on the copy stream. This parameter is a Boolean parameter, and its initial value is usually set to False (or 0); whether to use graph optimization (use_graph) indicates whether to enable graph optimization. This parameter is a Boolean parameter, and its initial value is usually set to False (or 0).
[0019] After executing the model reasoning task under the current model environment parameters, the corresponding current performance parameters are obtained, and the current fitness can be calculated through the current performance parameters.
[0020] The model environment parameter optimization method also includes: S010: Obtaining initial values of model environment parameters as current model environment parameters, wherein the model environment parameters include at least one of the following: batch size, number of replication streams, number of inference streams, whether to perform inference on replication streams, and whether to use graph optimization; S020: configuring the model operating environment with current model environment parameters, and obtaining corresponding current performance parameters, wherein the current performance parameters at least include: model reasoning speed and hardware utilization; S030: Determine the current fitness according to the current performance parameters.
[0021] The initial values of the model environment parameters are usually obtained by selecting random numbers within the value range of each model environment parameter. Schematically, the initial values of a set of model environment parameters are: batchsize = 1024; copy_streams = 5; infer_streams=5; run_infer_on_copy_streams=0; use_graph=0.
[0022] The current model environment parameters are the starting point of model reasoning. From this starting point, through the parameter optimization process, a parameter combination that is more conducive to model reasoning can be found.
[0023] Taking the current performance parameters including model inference speed and hardware utilization as an example, the current fitness is expressed as: F p = P p · U p in, F p Indicates the current fitness; P p Indicates the current model inference speed, represents the processing capacity of the model under a specific configuration, and reflects the number of samples processed beautifully; U p Indicates the current hardware utilization, which is used to measure the efficiency of the use of graphics cards or other hardware resources. It is mainly expressed by the utilization of video memory to ensure that hardware resources are used efficiently. In order to ensure that the fitness function is meaningful, the graphics card utilization U should be a positive indicator, that is, a higher utilization should indicate better resource utilization efficiency. If the graphics card utilization is too low, it means that the resources are not fully utilized; if the graphics card utilization is too high, it may lead to performance bottlenecks. Considering the fitness of hardware utilization is more in line with the hardware environment of the actual running model, and a compromise is achieved between model performance and hardware performance.
[0024] Fitness combines the model reasoning performance and the performance of the hardware when running the model reasoning task, and comprehensively evaluates the hardware resources and model performance. In some evaluation systems, especially the MLPerf evaluation system, the focus is on reasoning performance. Therefore, in the calculation of fitness, the performance indicators of model reasoning and hardware performance are directly used to evaluate the execution status.
[0025] Preferably, the current performance parameter also includes hardware power consumption.
[0026] Determine the current fitness based on the current performance parameters, including: according to: F p = P p · U p · W p , determine the current performance parameters, where Fp represents the current fitness, P p Indicates the current model inference speed, U p Indicates the current hardware utilization, W p Indicates the current hardware power consumption factor, controls the impact of GPU power consumption, ensures that power consumption is within the optimal operating range, and avoids performance loss or overload. Considers the adaptability of hardware power consumption, fully considers the actual hardware environment where the model is deployed, and conducts a more comprehensive evaluation from the aspects of inference performance, hardware performance, and energy consumption.
[0027] The current hardware power consumption factor is determined by the following formula: ; in, ; P actual Indicates the current power consumption of the hardware (usually the GPU). P max Indicates the maximum power consumption of the hardware (usually a GPU).
[0028] Specifically, S210: determining the domain parameters corresponding to the current model environment parameters according to the current model environment parameters, including: S211: Obtaining parameter types of current model environment parameters; S212: In response to the parameter type of the current model environment parameter being a continuous parameter, randomly increasing or decreasing the preset step length of the current model environment parameter to obtain a domain parameter; S213: In response to the parameter type of the current model environment parameter being an integer parameter, randomly increasing or decreasing the current model environment parameter by a preset value to obtain a domain parameter; S214: In response to the parameter type of the current model environment parameter being a Boolean parameter, the current model environment parameter is randomly inverted or remains unchanged to obtain a domain parameter.
[0029] When the model environment parameter optimization method recorded in the embodiment of the present application is used for parameter optimization, each iteration generates a domain parameter based on the current model environment parameter. For the batch size, which is a continuous parameter, the method for generating the corresponding domain parameter is to randomly increase or decrease the preset step size based on the current batch size value. Preferably, the preset compensation is set to 128.
[0030] For the number of replication flows and the number of inference flows, both of which are integer parameters, the method for generating the corresponding field parameters is to randomly increase or decrease the preset value based on the current number of replication flows and the current number of inference flows. Preferably, the preset value is 1.
[0031] For the two parameters of whether to infer on the replication stream and whether to use graph optimization, both are Boolean parameters. The method for generating the corresponding domain parameters is to randomly invert the current value or keep the current value unchanged.
[0032] Schematically, based on the model environment parameters batchsize=1024; copy_streams=5; infer_streams=5; run_infer_on_copy_streams=0; use_graph=0, the generated domain parameters can be: batchsize=1152 (increase by 128); copy_streams=6 (increase by 1); infer_streams=4 (decrease by 1); run_infer_on_copy_streams=1 (negate); use_graph=0 (remain unchanged).
[0033] Specifically, S210: determining a new performance parameter corresponding to the domain parameter and a new fitness corresponding to the new performance parameter, including: S215: Configure the model operating environment with domain parameters and complete the model reasoning task; S216: Obtain new performance parameters generated by the model executing the reasoning task under the domain parameter operating environment; wherein the new performance parameters at least include: new model reasoning speed and new hardware utilization; S217: The multiplied value of the new performance parameter is used as the new fitness.
[0034] Specifically, S220: determining the fitness difference according to the new fitness and the current fitness, including: According to: Δ f = F n – F p , determine the fitness difference, where Δ f represents the fitness difference, F n represents the new fitness, F p Indicates the current fitness.
[0035] Specifically, S230: updating the current model environment parameters according to the fitness difference, including: S231: In response to the value of the fitness difference being greater than a preset difference, the domain parameter is used as the current model environment parameter to update the current model environment parameter; S231a: In response to the value of the fitness difference being less than or equal to the preset difference, deciding whether to accept the domain parameter; S232a: In response to accepting the domain parameter, the domain parameter is used as the current model environment parameter, and the current model environment parameter is updated; S232b: In response to not accepting the domain parameters, the current model environment parameters are kept unchanged.
[0036] Specifically, the decision is whether to accept domain parameters, including: S2311a: Determine the acceptance probability value corresponding to the domain parameter according to the fitness difference; S2312a: Generate a random number; S2313a: Compare the random number with the acceptance probability value; S2314a: In response to the random number being less than the acceptance probability value, accepting the domain parameter as the current model environment parameter; S2314b: In response to the random number being greater than or equal to the acceptance probability value, the domain parameter is not accepted as the current model environment parameter.
[0037] Take the following formula as an example: ; in, P accept represents the acceptance probability, and T represents the temperature coefficient. P accept Preferably, the random number is generated between 0 and 1.
[0038] When the new fitness is greater than the current fitness, the domain parameters corresponding to the new fitness are accepted unconditionally; when the new fitness is less than or equal to the current fitness, there are still records accepting the domain parameters corresponding to the new fitness. This can avoid falling into the local optimal solution too early in the parameter optimization process and failing to obtain the global optimal solution.
[0039] Specifically, the current temperature coefficient is updated with the current temperature coefficient and the cooling factor, including: according to: T n = α · T c , determine the updated current temperature coefficient, where, T n Indicates the current temperature coefficient after update, α represents the cooling factor, T c Indicates the current temperature coefficient before updating.
[0040] The temperature coefficient is set from the initial value and gradually reduced by the cooling factor.
[0041] The initial temperature coefficient T0 is usually set between 50 and 200. Preferably, the embodiment of the present application sets the initial temperature coefficient T0 to 100. Setting the initial temperature coefficient T0 to 100 can explore the optimal parameters in a relatively large solution space without causing excessive computational costs. A higher initial temperature can increase the exploratory nature of the search space, allowing the algorithm to search extensively in the early stages to avoid falling into a local optimum. The initial temperature is usually set higher so that the algorithm can accept many different solutions in the early stages. This helps to avoid falling into a local optimal solution in the early stages and ensures a global search. In practical applications, the choice of T0 usually needs to be combined with the characteristics of the specific problem. For example, if the search space of the problem is very large, a higher initial temperature can be set to explore more fully.
[0042] Preferably, determining the cooling factor comprises: S241b: Get the fitness difference and current fitness; S242b: determining the proportion of the fitness difference to the current fitness difference according to the fitness difference and the current fitness; S243b: Determine the value of the cooling factor according to the numerical range of the difference ratio.
[0043] The cooling factor controls the rate at which the temperature coefficient decreases, and determines the degree to which the temperature decreases in each iteration. A larger cooling factor will result in a slower temperature drop, while a smaller cooling factor means a faster temperature drop. It is usually set in the range of 0.8 to 0.99. If you set a higher α If the value is close to 1, the parameter optimization process will maintain a higher temperature for a longer time, which will give it more opportunities to accept less excellent solutions and conduct a more extensive search. α If the value is set smaller, the parameter optimization process will converge faster, reduce the scope of exploration, and enter the local optimum earlier. Generally, it is selected between 0.9 and 0.99. If you want the search process to be more conservative and converge earlier, choose a smaller α This setting will gradually reduce the temperature, but maintain a longer exploration phase, preventing the algorithm from falling into the local optimum too early, and is suitable for finding the global optimal solution in a larger search space.
[0044] Termination temperature coefficient T m , when the temperature coefficient drops below the termination temperature coefficient, the parameter optimization process terminates. A lower termination temperature means a higher degree of "refinement" in the parameter optimization process. That is, smaller changes are accepted to explore a more detailed solution space. mControls the termination condition. When the temperature is too low, the parameter optimization process will almost no longer accept inferior solutions, and the search will enter a convergence state. If this value is set too low, it will lead to excessive calculations and difficulty in convergence. If it is set too high, the optimization may end prematurely. Common T m The value range is 0.1 to 1, depending on the size and accuracy of the problem. This value is small enough to ensure that the temperature drops to a near-steady state, but not so small that the parameter optimization process wastes too much time on small changes, maintaining high computational efficiency.
[0045] Specifically, S243b: determining the value of the cooling factor according to the value range of the difference ratio, including: In response to the difference ratio being greater than a first preset value, setting the cooling factor to a first cooling factor; In response to the difference ratio being less than or equal to the first preset value and greater than the second preset value, setting the cooling factor to the second cooling factor; In response to the difference ratio being less than or equal to the second preset value and greater than the third preset value, setting the cooling factor to the third cooling factor; In response to the difference ratio being less than or equal to the third preset value and greater than the fourth preset value, setting the cooling factor to the fourth cooling factor; In response to the difference ratio being less than or equal to the fourth preset value, the cooling factor is set to a fifth cooling factor.
[0046] The difference ratio is given by: p f =Δ f / F p Determine, among which, p f Indicates the difference ratio.
[0047] Illustratively, the first preset value is 10%, the second preset value is 3%, the third preset value is 1%, and the fourth preset value is 0%.
[0048] Schematically, corresponding to p f >10%, cooling factor α The value is 0.97; corresponding to 10% ≥ p f >3%, cooling factor α The value is 0.93; corresponding to 3% ≥ p f >1%, cooling factor α The value is 0.90; corresponding to 1%≥ p f >0%, cooling factor αThe value is 0.88. A large change in the difference ratio indicates a significant change in fitness. In the parameter optimization process, a larger cooling factor can be set to continue to fully explore the solution space; when the difference ratio changes very little, the cooling factor can be lowered to accelerate convergence and quickly reach the optimal environmental parameters.
[0049] Specifically, the model environment parameter optimization method also includes: In response to the temperature coefficient falling below a preset minimum temperature, or After the parameter optimization process has been iterated for a preset number of times, the fitness difference does not exceed the preset threshold, or If the parameter optimization process iteration exceeds the preset maximum number, the parameter optimization process is terminated.
[0050] Indicatively, the preset maximum number is 50 times, the preset threshold is 10, and the preset maximum number is 100 times. By setting the termination condition, the parameter optimization process can be stopped in time when the parameter optimization process meets the termination condition, thereby avoiding the waste of computing resources.
[0051] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0052] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0053] In other embodiments, Figure 2 As shown, a model environment parameter optimization device comprises: A parameter acquisition module, used to acquire a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; The parameter optimization module is used to execute the parameter optimization process until the termination condition is met, wherein the parameter optimization process includes: A new solution calculation unit, used to determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; A difference calculation unit, used for determining a fitness difference according to the new fitness and the current fitness; A parameter updating unit, used to update the current model environment parameters according to the fitness difference; A result output unit, configured to output the current model environment parameters in response to the updated current model environment parameters satisfying the termination condition; The coefficient updating unit is used to update the current temperature coefficient with the current temperature coefficient and the cooling factor in response to the updated current model environment parameter not satisfying the termination condition, and repeat the parameter optimization process, wherein the cooling factor represents the decrease range of the current temperature coefficient.
[0054] For the specific definition of the model environment parameter optimization device, please refer to the definition of the model environment parameter optimization method above, which will not be repeated here. The various modules in the above-mentioned model environment parameter optimization device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0055] In other embodiments, Figure 3 As shown, a computer device includes a memory, a processor, and a model environment parameter optimization program stored in the memory and executable on the processor. When the processor executes the model environment parameter optimization program, the model environment parameter optimization method described in the first aspect is implemented. Specifically, it includes: Obtaining a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; The parameter optimization process is executed until the termination condition is met, wherein the parameter optimization process includes: Determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; Determine the fitness difference based on the new fitness and the current fitness; Update the current model environment parameters according to the fitness difference; In response to the updated current model environment parameters satisfying the termination condition, outputting the current model environment parameters; In response to the updated current model environment parameter not satisfying the termination condition, the current temperature coefficient is updated with the current temperature coefficient and the cooling factor, and the parameter optimization process is repeated, wherein the cooling factor represents the decrease range of the current temperature coefficient.
[0056] In some other embodiments, the present application further provides a computer-readable storage medium on which a model environment parameter optimization program is stored. When the model environment parameter optimization program is executed by a processor, the model environment parameter optimization method recorded in the first aspect is implemented. Specifically, it includes: Obtaining a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; The parameter optimization process is executed until the termination condition is met, wherein the parameter optimization process includes: Determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; Determine the fitness difference based on the new fitness and the current fitness; Update the current model environment parameters according to the fitness difference; In response to the updated current model environment parameters satisfying the termination condition, outputting the current model environment parameters; In response to the updated current model environment parameter not satisfying the termination condition, the current temperature coefficient is updated with the current temperature coefficient and the cooling factor, and the parameter optimization process is repeated, wherein the cooling factor represents the decrease range of the current temperature coefficient.
[0057] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0058] In other embodiments, the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the model environment parameter optimization method described in the first aspect. Specifically, it includes: Obtaining a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; The parameter optimization process is executed until the termination condition is met, wherein the parameter optimization process includes: Determine, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; Determine the fitness difference based on the new fitness and the current fitness; Update the current model environment parameters according to the fitness difference; In response to the updated current model environment parameters satisfying the termination condition, outputting the current model environment parameters; In response to the updated current model environment parameter not satisfying the termination condition, the current temperature coefficient is updated with the current temperature coefficient and the cooling factor, and the parameter optimization process is repeated, wherein the cooling factor represents the decrease range of the current temperature coefficient.
[0059] By implementing a model environment parameter optimization method, device, medium and program product provided in the embodiment of the present application, the efficiency of model environment parameter optimization can be improved by executing the parameter optimization process, and the global optimal solution can be obtained. The problem that manual debugging of environment parameters is time-consuming, inefficient and difficult to obtain the global optimal solution is solved.
[0060] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0061] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program loaded on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a memory, or installed from a ROM. When the computer program is executed by an external processor, the above-mentioned functions defined in the method of the embodiment of the present application are executed.
[0062] It should be noted that the computer-readable medium of the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In an embodiment of the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0063] The computer-readable medium may be included in the server; or it may exist independently without being installed in the server. The computer-readable medium carries one or more programs. When the one or more programs are executed by the server, the server: in response to detecting that the peripheral mode of the terminal is not activated, obtains the frame rate of the application on the terminal; when the frame rate meets the screen-off condition, determines whether the user is obtaining the screen information of the terminal; in response to the judgment result that the user is not obtaining the screen information of the terminal, controls the screen to enter the immediate dimming mode.
[0064] Computer program code for performing the operation of the embodiments of the present application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).
[0065] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0066] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.
[0067] The above is a detailed introduction to a model environment parameter optimization method, device, medium and program product provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The above embodiments are only preferred embodiments of the present application, which are used to help understand the method and core ideas of the present application and are not intended to limit the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application, these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A method for optimizing model environment parameters, characterized in that: include: Acquire a current temperature coefficient, a current model environment parameter, a current performance parameter corresponding to the current model environment parameter, and a current fitness corresponding to the current performance parameter; Execute the parameter optimization process until the termination condition is met, wherein the parameter optimization process includes: Determining, according to the current model environment parameters, a domain parameter corresponding to the current model environment parameters, a new performance parameter corresponding to the domain parameter, and a new fitness corresponding to the new performance parameter; Determining a fitness difference according to the new fitness and the current fitness; According to the fitness difference, updating the current model environment parameters; In response to the updated current model environment parameters satisfying the termination condition, outputting the current model environment parameters; In response to the updated current model environment parameter not satisfying the termination condition, the current temperature coefficient is updated with the current temperature coefficient and a cooling factor, and the parameter optimization process is repeated, wherein the cooling factor represents a decrease in the current temperature coefficient.
2. The model environment parameter optimization method according to claim 1, characterized in that: The method also includes: Obtaining an initial value of a model environment parameter as the current model environment parameter, wherein the model environment parameter includes at least one of the following: batch size, number of replication streams, number of inference streams, whether to perform inference on replication streams, and whether to use graph optimization; The model operating environment is configured with the current model environment parameters, and the corresponding current performance parameters are obtained, wherein the current performance parameters at least include: model reasoning speed and hardware utilization; The current fitness is determined according to the current performance parameter.
3. The model environment parameter optimization method according to claim 2, characterized in that: The current performance parameters also include hardware power consumption; The determining the current fitness according to the current performance parameter includes: according to: F p = P p · U p · W p , determine the current performance parameters, wherein the F p Represents the current fitness, P p Indicates the current model inference speed. U p Indicates the current hardware utilization. W p Indicates the current hardware power consumption factor.
4. The model environment parameter optimization method according to claim 1, characterized in that: The step of determining, according to the current model environment parameter, a domain parameter corresponding to the current model environment parameter comprises: Obtaining the parameter type of the current model environment parameter; In response to the parameter type of the current model environment parameter being a continuous parameter, randomly increasing or decreasing a preset step length of the current model environment parameter to obtain the domain parameter; In response to the parameter type of the current model environment parameter being an integer parameter, randomly increasing or decreasing a preset value of the current model environment parameter to obtain the domain parameter; In response to the parameter type of the current model environment parameter being a Boolean parameter, the current model environment parameter is randomly inverted or remains unchanged to obtain the domain parameter.
5. The model environment parameter optimization method according to claim 1, characterized in that: Determining a new performance parameter corresponding to the domain parameter and a new fitness corresponding to the new performance parameter includes: Configure the model operating environment with the domain parameters and complete the model reasoning task; Obtain new performance parameters generated by the model executing the reasoning task under the domain parameter operating environment; wherein the new performance parameters at least include: new model reasoning speed and new hardware utilization; The value obtained by multiplying the new performance parameters is used as the new fitness.
6. The model environment parameter optimization method according to claim 1, characterized in that: The determining of the fitness difference according to the new fitness and the current fitness includes: According to: Δ f = F n – F p , determine the fitness difference, where the Δ f represents the fitness difference, F n Represents the new fitness, F p Indicates the current fitness.
7. The model environment parameter optimization method according to claim 1, characterized in that: The updating of the current model environment parameters according to the fitness difference includes: In response to the value of the fitness difference being greater than a preset difference, using the domain parameter as the current model environment parameter to update the current model environment parameter; In response to the value of the fitness difference being less than or equal to the preset difference, deciding whether to accept the domain parameter; In response to accepting the domain parameter, the domain parameter is used as the current model environment parameter to update the current model environment parameter; In response to not accepting the domain parameters, the current model environment parameters are kept unchanged.
8. The model environment parameter optimization method according to claim 7, characterized in that: The decision whether to accept the field parameters includes: Determining acceptance probability values corresponding to the domain parameters based on the fitness differences; Generate random numbers; Compare the random number with the acceptance probability value; In response to the random number being less than the acceptance probability value, accepting the domain parameter as the current model environment parameter; In response to the random number being greater than or equal to the acceptance probability value, the domain parameter is not accepted as the current model environment parameter.
9. The model environment parameter optimization method according to claim 1, characterized in that: The updating of the current temperature coefficient by using the current temperature coefficient and the temperature reduction factor includes: according to: T n = α · T c , determine the updated current temperature coefficient, where the T n Indicates the updated current temperature coefficient, α represents the cooling factor, T c Indicates the current temperature coefficient before updating.
10. The model environment parameter optimization method according to claim 9, characterized in that: Determining the cooling factor includes: Get the fitness difference and current fitness; Determine, according to the fitness difference and the current fitness, a ratio of the fitness difference to the current fitness difference; The value of the cooling factor is determined according to the value interval of the difference ratio.
11. The model environment parameter optimization method according to claim 10, characterized in that: The determining the value of the cooling factor according to the value interval of the difference ratio includes: In response to the difference ratio being greater than a first preset value, setting the cooling factor to a first cooling factor; In response to the difference ratio being less than or equal to a first preset value and greater than a second preset value, setting the cooling factor to a second cooling factor; In response to the difference ratio being less than or equal to a second preset value and greater than a third preset value, setting the cooling factor to a third cooling factor; In response to the difference ratio being less than or equal to a third preset value and greater than a fourth preset value, setting the cooling factor to a fourth cooling factor; In response to the difference ratio being less than or equal to a fourth preset value, the cooling factor is set to a fifth cooling factor.
12. The model environment parameter optimization method according to claim 1, characterized in that: The method further comprises: In response to the temperature coefficient falling below a preset minimum temperature, or After the parameter optimization process has been iterated for a preset number of times, the fitness difference does not exceed a preset threshold, or If the parameter optimization process iteration exceeds a preset maximum number of times, the parameter optimization process is terminated.
13. A computer device, characterized in that: The invention comprises a memory, a processor and a model environment parameter optimization program stored in the memory and executable on the processor. When the processor executes the model environment parameter optimization program, the model environment parameter optimization method according to any one of claims 1 to 12 is implemented.
14. A computer-readable storage medium, characterized in that: A model environment parameter optimization program is stored thereon, and when the model environment parameter optimization program is executed by a processor, the model environment parameter optimization method according to any one of claims 1 to 12 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the model environment parameter optimization method described in any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
User classification model determination method, apparatus and device, and storage medium
CN111612528A
Circuit parameter optimization method, system and equipment based on Gaussian model and medium
CN116738917A
Processor power consumption adjusting method and device and computer equipment
CN117193507A
Parameter optimization method and device, compiling method and device, electronic device and medium
CN118551820A
Automatic large model fusion processing method and device, storage medium and electronic equipment
CN118656646A