Power consumption control methods and electronic devices

By detecting the resources and operating status of electronic devices, determining the theoretical inference count, and reasonably controlling power consumption, the problem of excessive processor load caused by model inference tasks was solved, achieving power consumption stability and improving user experience.

CN119376517BActive Publication Date: 2025-11-14HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411948611.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-11-14
Estimated Expiration
2044-12-27

AI Technical Summary

Technical Problem

Deploying models in electronic devices to perform inference tasks can lead to excessive processor load, increased power consumption, and negatively impact the user experience.

Method used

By detecting the resources and operating status of electronic devices, the theoretical inference count is determined, and the target inference task is executed when the theoretical inference count is greater than zero, thereby reasonably controlling power consumption.

Benefits of technology

Effectively maintain the power consumption of electronic devices at a relatively stable level and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376517B_ABST
    Figure CN119376517B_ABST
Patent Text Reader

Abstract

This application provides a power consumption control method and an electronic device, relating to the field of terminal technology. The method is applied to an electronic device with a deployed model. The method includes: responding to a first operation by loading a preset model; the first operation triggering a target function; the preset model running on the electronic device when the target function is executed; detecting the resources and operating status of the electronic device to obtain corresponding target resource data; inputting the target resource data into an inference prediction model; analyzing the target resource data to obtain the theoretical number of inference attempts supported by the target resource data for executing inference tasks; enabling the electronic device to execute the target inference task corresponding to the theoretical number of inference attempts; and maintaining the power consumption of the electronic device at a relatively stable level while executing these target inference tasks, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to a power consumption control method and an electronic device. Background Technology

[0002] As electronic devices become increasingly powerful and model applications expand in depth, manufacturers are actively deploying models within their devices, with a key objective being to enhance data security. For example, deploying language models in electronic devices allows them to process and analyze data using these models, effectively reducing risks during data transmission and lowering the likelihood of data leaks, tampering, and other security vulnerabilities.

[0003] However, when electronic devices use models to perform inference tasks, the load on the processor, especially the integrated graphics processor and embedded neural network processor, will increase, resulting in increased power consumption of the electronic devices and affecting the user experience. Summary of the Invention

[0004] This application provides a power consumption control method and an electronic device, which enables the processor to detect the resources of the electronic device before executing inference tasks, and to perform inference tasks in a reasonable manner, thereby achieving reasonable control and optimization of the power consumption of the electronic device.

[0005] In a first aspect, a power consumption control method is provided, applied to an electronic device, wherein a preset model is deployed on the electronic device, comprising: loading the preset model in response to a first operation, the first operation being used to trigger a target function, the electronic device running the preset model when executing the target function; detecting the resources and operating status of the electronic device to obtain target resource data; inputting the target resource data into an inference prediction model to obtain a theoretical inference count, wherein the theoretical inference count is the maximum number of inference tasks to be executed corresponding to the target resource data; and executing a target inference task based on the preset model when the theoretical inference count is greater than zero, wherein the target inference task is determined by the theoretical inference count.

[0006] It should be understood that the theoretical inference count is the maximum number of inference tasks that the target resource data can support by performing inference tasks through a preset model.

[0007] It should be understood that the preset model is used to perform inference tasks, and there may be multiple inference tasks. Therefore, in order to reduce the power consumption of electronic devices or suppress the rise in power consumption of electronic devices, when the theoretical number of inferences is greater than zero, target inference tasks that support the execution of the preset model are determined, and these target inference tasks are executed based on the preset model.

[0008] After the preset model is loaded, if the corresponding inference task is performed directly based on the preset model, it will lead to excessive processor load, such as iGPU load reaching 90% or more, thereby increasing the power consumption of the electronic device. Therefore, in this embodiment, before executing a specific inference task through the preset model, the resources and operating status of the electronic device are detected, and the detected target resource data is analyzed to obtain the number of inference tasks that the target resource data supports to be executed through the preset model, i.e., the theoretical number of inferences. This allows for reasonable control and optimization of power consumption when the processor executes the target inference task corresponding to the theoretical number of inferences, maintaining the power consumption of the electronic device at a relatively stable level.

[0009] In one possible implementation, the target inference task based on a preset model is executed, which further includes: during the execution of the target inference task, detecting the resources and operating status of the electronic device based on a preset first monitoring frequency to obtain updated target resource data; inputting the updated target resource data into the inference prediction model to obtain the updated theoretical inference count; and stopping the execution of the target inference task when the updated theoretical inference count is zero.

[0010] In the process of executing the target inference task, the embodiments of this application continue to monitor the resources and operating status of the electronic device in real time, which can ensure the smooth execution of the target inference task and the reasonable use of hardware resources; and when the updated theoretical inference count determined by the updated target resource data is zero, the execution of the target inference task is stopped, and the power consumption of the electronic device is reasonably controlled.

[0011] In one possible implementation, before executing the target inference task based on the preset model, the method further includes: obtaining alternative inference tasks corresponding to the target function; arranging the alternative inference tasks in descending order of priority to obtain an initial inference task queue; and using the first N alternative inference tasks in the initial inference task queue as the target inference task, where N is a positive integer less than or equal to the theoretical number of inferences.

[0012] It should be understood that all inference tasks involved in the initial inference task queue are determined by the application scenario corresponding to the target function, and the initial inference task queue contains multiple inference tasks.

[0013] After arranging the candidate inference tasks in order of priority, the highest priority inference task is selected from the initial inference task queue based on the theoretical inference count as the target inference task. This can ensure the effective realization of the target function and maintain the power consumption of the electronic device at a relatively stable level.

[0014] In one possible implementation, after the target resource data is input into the inference prediction model and the theoretical inference count is obtained, the method further includes: if the theoretical inference count is zero, based on a preset first monitoring frequency, not executing the inference tasks in the initial inference task queue, and detecting the resources and operating status of the electronic device to obtain updated target resource data.

[0015] It should be understood that if the theoretical number of inference attempts is zero before the target inference task has been executed, it indicates that the electronic device does not meet the requirements for executing the inference task. Therefore, the inference task is not executed, and the resources and operating status of the electronic device continue to be monitored based on a preset first monitoring frequency to obtain updated target resource data. This facilitates the timely execution of the inference task when the resources and operating status of the electronic device support its execution, thereby improving system stability.

[0016] In one possible implementation, the resources and operating status of the electronic device are detected to obtain target resource data, including: each time the resources and operating status of the electronic device are detected, the resources and operating status of the electronic device are sampled M times within a unit time to obtain M sets of sampled data; the mean of the M sets of sampled data is calculated to obtain the target resource data.

[0017] Each time the resources and operating status of electronic devices are detected, the number of samples per unit time can be increased and the average value of these sampled data can be calculated to improve the accuracy of the target resource data.

[0018] In one possible implementation, loading the preset model in response to the first operation includes: monitoring the memory of the electronic device based on a preset second monitoring frequency to obtain the memory occupancy rate; if the memory occupancy rate is less than a preset threshold, loading the preset model, wherein the preset threshold is determined by the memory capacity in the electronic device.

[0019] Before loading the preset model, this application embodiment adds monitoring of the electronic device's memory, which can determine in advance whether the electronic device has enough space to accommodate the preset model, avoiding loading failure of the preset model due to insufficient memory; at the same time, it can prevent the already insufficient memory situation from being further aggravated by loading the preset model, thereby causing system performance degradation or even crash; it can also provide a basis for optimizing the preset model, such as determining whether the preset model needs to be compressed to match the memory capacity.

[0020] It should be noted that in the above methods, the resources of the electronic device include CPU load and GPU load, and the operating status of the electronic device includes plug-in status and electronic device temperature.

[0021] In one possible implementation, the target function includes a first function, during which the electronic device runs a preset language model. The power consumption control method includes: in response to a second operation, loading the preset language model, the second operation being used to trigger the first function; detecting the CPU load, iGPU load, plug-in status, and temperature of the electronic device to obtain first resource data; inputting the first resource data into an inference prediction model to obtain a first inference count; and, if the first inference count is greater than zero, determining a first inference task to be executed by the preset language model based on the first inference count.

[0022] It should be understood that the target function includes multiple functions. Among them, some primary functions require running a preset language model on the electronic device during execution. For example, the semantic search function requires a preset language model, and the corresponding function is achieved by running the preset language model. The preset language model can be a large language model or a multimodal model, etc.

[0023] Taking the semantic search function on a personal computer as an example, by adding periodic monitoring of the power-on status, case temperature, CPU load, and GPU load of the personal computer, and calculating the theoretical number of inferences based on the target resource data obtained from the monitoring, the target inference task is obtained from the initial inference task queue for execution. This allows the personal computer to execute the corresponding target inference task based on the preset language model. When the processor in the personal computer executes these target inference tasks, the power consumption of the electronic device is maintained at a relatively stable level, or even reduced, thereby improving the user experience.

[0024] In one possible implementation, the process of the preset language model performing the first inference task further includes: if the first inference task is keyword extraction, determining the extracted queue text; if the length of the queue text is greater than or equal to the length of the recorded text, stopping the keyword extraction, wherein the recorded text is the text obtained by speech recognition of the user's input when the first function is triggered, or the text input by the user.

[0025] It should be understood that the hardware conditions of electronic devices deploying pre-defined models, the number of model parameters, and model compression during operation can all lead to a decrease in the accuracy of the pre-defined model. When the pre-defined language model within the pre-defined model performs inference tasks with low accuracy, especially during keyword extraction, there may be duplicate keyword extraction, which in turn will prevent the inference task from obtaining inference results.

[0026] Therefore, in the reasoning process where the target reasoning task is keyword extraction, the extracted queue text and record text are first compared. By analyzing the queue text, the efficiency of performing the target reasoning task through the preset language model is improved, and the accuracy of the reasoning is also improved.

[0027] In one possible implementation, the electronic device includes a resource monitoring module, and the power consumption control method includes: in response to a first operation, the resource monitoring module loads a preset model; the resource monitoring module detects the resources and operating status of the electronic device to obtain target resource data; the resource monitoring module inputs the target resource data into the inference prediction model to obtain the theoretical inference count; if the theoretical inference count is greater than zero, the resource monitoring module executes the target inference task based on the preset model.

[0028] In this embodiment, a resource monitoring module is added to enable specific control of the model. During the power consumption control process, the memory, resources and operating status of electronic devices can be monitored to maintain the power consumption of electronic devices at a relatively stable level, thereby improving the model's performance in the inference task.

[0029] In a second aspect, an electronic device is provided, comprising a processor and a memory, the memory for storing computer programs, and the processor for retrieving and running the computer programs from the memory, such that the electronic device performs any of the power consumption control methods of the first aspect.

[0030] Thirdly, a power consumption control device is provided, including a unit for performing any of the methods in the first aspect. This device may be a terminal device or a chip within the terminal device.

[0031] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when executed, causes any of the power consumption control methods described in the first aspect to be performed.

[0032] Fifthly, a computer program product is provided, comprising a computer program that, when run, causes any of the power consumption control methods described in the first aspect to be executed.

[0033] It is understandable that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0034] Figure 1 This diagram illustrates a personal computer accessing an intelligent search application to perform a semantic search.

[0035] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application is shown;

[0036] Figure 3 A schematic diagram of a system architecture of an electronic device according to an embodiment of this application is shown;

[0037] Figure 4 A schematic diagram illustrating an application scenario to which an embodiment of this application applies is shown;

[0038] Figure 5 A flowchart illustrating a power consumption control method provided in an embodiment of this application is shown;

[0039] Figure 6 A flowchart illustrating another power consumption control method provided in an embodiment of this application is shown;

[0040] Figure 7 A flowchart illustrating another power consumption control method provided in an embodiment of this application is shown;

[0041] Figure 8 A schematic diagram of the power consumption control implemented through a resource monitoring module according to an embodiment of this application is shown;

[0042] Figure 9 A flowchart illustrating another power consumption control method provided in an embodiment of this application is shown;

[0043] Figure 10 A schematic diagram of the power consumption control device provided in an embodiment of this application is shown. Detailed Implementation

[0044] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.

[0045] Hereinafter, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include one or more of that feature.

[0046] For ease of understanding, the models involved in the embodiments of this application are introduced and explained.

[0047] In this embodiment, the model, also known as an edge-side model, is deployed within an electronic device; that is, it is installed, stored, and runs on the electronic device, independent of the cloud. Its main components include machine learning models, such as language models, image recognition models, and multimodal models, and may also include other intelligent algorithm models. The model primarily performs inference tasks based on data generated within the electronic device, such as performing functions like image recognition, speech recognition, semantic search, target detection, and language translation.

[0048] Processing data generated internally on electronic devices directly can effectively protect data privacy, reduce potential security risks during data transmission, improve the security and timeliness of data processing, fully leverage the intelligent processing capabilities of electronic devices, and better adapt to the data processing needs of various application scenarios.

[0049] Furthermore, the improved performance of electronic devices provides ample computing power and storage resources for edge models, enabling them to run more complex algorithms and model architectures. Leveraging their powerful hardware, the models deployed within electronic devices can process and rapidly compute massive amounts of data, meeting diverse needs such as real-time and privacy-sensitive data processing in intelligent interaction scenarios. Therefore, a key objective of electronic device manufacturers in actively deploying models within their devices is to mitigate potential security risks during data transmission and cloud storage, thereby enhancing data security and providing users with a more reliable and secure user environment.

[0050] It should be understood that models can be deployed on the processors of electronic products using specific deployment frameworks or technologies, such as integrated graphics processing units (iGPUs) and embedded neural processing units (NPUs), thereby enabling the processor to perform relevant inference tasks. In this process, the model is loaded into its runtime environment in a way that adapts to the processor architecture, and then utilizes the processor's computing power to process and analyze the input data, ultimately achieving the execution of inference tasks. This provides strong support for electronic products to achieve intelligent data processing and decision-making locally.

[0051] For example, by deploying a language model in electronic devices, users can interact with the devices naturally and fluently through voice or text input. The language model can understand the user's intent and give an accurate response, making the interaction more convenient and human-like, as if the user is communicating with an intelligent assistant. For example, voice interaction and intelligent search of documents, videos, and audio.

[0052] For example, an intelligent search application installed in an electronic device can perform reasoning through a language model deployed in the device, thereby enabling semantic search and accurately locating information content that closely matches the user's search intent.

[0053] Figure 1 This diagram illustrates a personal computer accessing an intelligent search application to perform a semantic search; such as... Figure 1 As shown in (a), the first search window 20 after the smart search application is opened has a search area 21 in which the user can enter the content they want to search.

[0054] For example, the text "paper" entered by the user in the search area 21 of the first search window 20, such as... Figure 1 As shown in (b); the personal computer (PC) searches for documents based on the user's input of "paper," and the search results are as follows. Figure 1 As shown in (c), keyword search results and semantic search results are displayed in the second search window 30.

[0055] In the example above, the personal computer performs a search based on the user's input of "paper", including keyword search and semantic search. In performing the keyword search and semantic search, multiple inference tasks need to be performed by the language model deployed in the personal computer, such as keyword extraction and semantic analysis.

[0056] It should be understood that during the process of electronic devices using models to perform inference tasks, the load on iGPUs often increases significantly. When performing inference tasks on more complex or large-scale models, the load on iGPUs may rise to 90% or even 100%. This is because the model needs to process and compute a large amount of data at high speed during the inference process. iGPUs have a large number of parallel computing units, and when faced with such high-intensity inference task demands, their resource utilization will rise sharply, resulting in a significant increase in load. iGPUs often need to operate at full capacity to meet the needs of model inference, thus keeping their load at a high level.

[0057] Furthermore, increased iGPU load leads to increased power consumption, which in turn increases the power consumption of electronic devices and may even cause them to lag, affecting the user experience.

[0058] It should be noted that the high iGPU load is due to the system framework and the loading and running of models through the inference platform. When the iGPU load cannot be reasonably and effectively controlled, the power consumption of electronic devices can be effectively controlled and kept at a relatively stable level by monitoring the resources of electronic devices, thereby improving the user experience of electronic devices.

[0059] In view of this, embodiments of this application provide a method for running a model and an electronic device. The method is applied to an electronic device on which a preset model is deployed. The power consumption control method includes loading the preset model in response to a first operation, the first operation being used to trigger a target function, and the electronic device running the preset model when executing the target function. By detecting the resources and operating status of the electronic device, corresponding target resource data is obtained. This target resource data is then input into an inference prediction model, and the target resource data is analyzed to obtain the theoretical number of inferences supported by the preset model. This allows the electronic device to execute the target inference task corresponding to the theoretical number of inferences. Consequently, when the processor in the electronic device executes these inference tasks, the power consumption of the electronic device remains at a relatively stable level, or even reduces the power consumption of the electronic device, improving the user experience.

[0060] The following description, in conjunction with the accompanying drawings, illustrates the operation method of the model provided in the embodiments of this application. This method is applied to electronic devices, which may be terminal devices such as personal computers, laptops, tablets (Pads), mobile phones, smart TVs, wearable devices, in-vehicle electronic devices, laptops, personal digital assistants (PDAs), smart home devices, and medical monitoring devices. The embodiments of this application do not impose any special limitations on the specific technologies and forms adopted by the electronic devices.

[0061] Figure 2 This illustration shows a hardware structure diagram of an electronic device according to an embodiment of this application. For example, a personal computer is used as an example of the electronic device. Figure 2As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, a wireless communication module 160, an audio module 170, a speaker 170A, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a camera 193, a display screen 194, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an accelerometer sensor 180E, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, etc.

[0062] It should be noted that, Figure 2 The connection relationships between the modules shown are merely illustrative and do not constitute a limitation on the connection relationships between the modules in the electronic device 100. In other embodiments of this application, the electronic device 100 may include more than Figure 2 The components shown may include more or fewer components, or the electronic device 100 may include... Figure 2 The components shown may be a combination of certain components, or the electronic device 100 may include... Figure 2 Sub-components of some of the components shown. Figure 2 The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0063] Processor 110 may include one or more processing units, such as a central processing unit (CPU), graphics processing unit (GPU), iGPU, NPU, digital signal processor (DSP), application processor (AP), modem processor, image signal processor (ISP), controller, video codec, baseband processor, and / or neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.

[0064] iGPUs are typically integrated within the CPU chip and share system memory. While iGPUs are relatively weaker in performance than GPUs, they are characterized by low power consumption. Therefore, some edge-side models can be deployed using iGPUs.

[0065] An NPU is a processor specifically designed for neural network computation, offering higher efficiency and performance in handling deep learning model-related computational tasks. In some cases, models can be deployed using both iGPUs and NPUs, leveraging the strengths of both processors through collaborative work to improve model processing performance. In other situations, such as models with lower computational performance requirements, iGPUs can be prioritized. When iGPUs cannot meet the model's performance needs or when the model has high requirements for computational resources and efficiency, NPUs can be considered.

[0066] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.

[0067] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from this memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0068] In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0069] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0070] Internal memory 121 can be used to store computer-executable program code; computer-executable program code includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121.

[0071] It should be understood that the internal memory 121 may include high-speed random-access memory (RAM) and hard disks, etc.

[0072] Among them, high-speed random access memory (RAM) is a type of computer memory. In electronic devices, RAM is used to temporarily store running programs and data during operation. For example, when a user uses a smart search application, the application's code and related data are loaded into RAM so that the processor can quickly read and process this information to ensure the smooth operation of the application.

[0073] If the electronic device is a terminal device such as a mobile phone or tablet, its internal memory may include RAM and non-volatile memory (NVM). Non-volatile memory is a type of memory that can retain stored data even when power is off. The storage method of non-volatile memory allows data to be preserved even when there is no power supply.

[0074] The charging management module 140 is used to receive charging input from the charger. The charger can be a wireless charger or a wired charger.

[0075] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0076] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc.

[0077] The electronic device 100 runs an operating system, such as Windows, Android, Linux, Unix, iOS, or others. Applications can be installed and run on the operating system.

[0078] The operating system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the Windows operating system as an example to exemplify the system architecture of electronic device 100.

[0079] It should be noted that although the embodiments of this application are described using the Windows operating system as an example, the basic principles are also applicable to electronic devices 100 with other operating systems.

[0080] The software system of electronic device 100 can be divided into several layers, each with a clear role and division of labor, and the layers communicate with each other through software interfaces.

[0081] It should be understood that the Windows operating system is mainly divided into the user layer and the kernel layer. Figure 3 This illustration shows a system architecture diagram of an electronic device according to an embodiment of this application. In this embodiment, an inference platform layer and a model layer are abstracted, such as... Figure 3 As shown, the Windows operating system is divided into an application layer, a system service layer, an inference platform layer, a model layer, and a kernel layer. Among them, the inference platform layer and the model layer are used to load models on electronic devices, obtain results through model inference, and thus implement the model-related tasks on electronic devices.

[0082] The application layer includes applications, which can include a series of applications, such as intelligent search applications, document applications, gallery applications, and music applications (applications can be simply referred to as apps). Users can use these applications to achieve various specific functions, some of which require models in the model processing layer to complete.

[0083] The system service layer includes system services and interfaces, providing applications with interfaces and services for interacting with the operating system. System services include services corresponding to applications, such as search services and document services; system interfaces include application programming interfaces (Windows API), which enable applications to call the functions of the operating system to perform various operations, such as file reading and writing, memory allocation and release, etc.

[0084] The system service layer also includes a resource monitoring module, which is used to implement the functional requirements of search services and document services, and to monitor model operation, such as model loading, inference tasks, etc.

[0085] The inference platform layer is built on top of the system service layer and uses the models provided by the model layer to perform inference tasks. Specifically, the inference platform accelerates the inference process of the models in the model layer. By optimizing the models and utilizing the acceleration capabilities of specific hardware, the inference platform enables the models to obtain results faster when processing new data for inference tasks such as prediction, classification, and keyword extraction. This also facilitates the deployment of models on electronic devices corresponding to different application scenarios.

[0086] The inference platform layer can include one inference platform or multiple inference platforms, such as... Figure 3 The system comprises three inference platforms: the first, the second, and the third. The inference platform is used to deploy models on processors such as NPUs and iGPUs in electronic devices; it is also known as the inference engine.

[0087] Inference platforms enable inference tasks to be performed on pre-trained machine learning or deep learning models. Inference is the process of using a trained model to predict or analyze new data inputs.

[0088] For example, inference platforms could be Intel's OpenVino (Open Visual Inference and Neural Network Optimization), Qualcomm's Qualcomm Neural Network (QNN), or NVIDIA's TensorRT. Inference platforms help developers optimize trained models and deploy them to corresponding electronic devices. Optimization, such as model quantization, converts model parameters from high precision to low precision.

[0089] Some inference platforms support multiple operating systems, such as Windows, Linux, and Android, which allows developers to use the inference platform for model inference in different operating system environments.

[0090] It should also be understood that different inference platforms may involve different physical hardware during the inference process. For example, OpenVino can effectively utilize CPUs and iGPUs for inference.

[0091] The model layer contains various machine learning and / or deep learning models. These models are trained on large amounts of data to solve specific tasks. In practical applications, the models in the model layer are invoked by the inference platform layer to generate corresponding output results based on the input data.

[0092] In scenarios involving semantic search, the models involved can be language models and / or large language models, etc.; while in scenarios involving image recognition through speech or text, the models involved can be multimodal models and / or language models, image recognition models, etc.

[0093] In other words, the models involved are related to specific application scenarios, and these models are all computing models deployed on electronic devices; the number of models can be one or more. For example... Figure 3 The first model, the second model, and the third model in the text.

[0094] Taking the application of language models as an example, the first model is a large edge language model with 3B parameters; the second model is an edge language model, which is a small language model; and the third model is a large edge language model with 1.5B parameters.

[0095] It should be understood that the "B" in the number of parameters usually refers to one billion, so 3B means that the model has 3 billion parameters.

[0096] It's important to note that different electronic devices have varying storage capacities and computing resources, resulting in differences in the models that can be deployed on them. For example, smartwatches and mobile phones, limited by their storage capacity and computing resources, often deploy small language models, such as the second model. These small models have relatively few parameters, occupy little storage space, and have lower memory requirements during runtime, allowing them to load and run quickly on devices with limited memory. On the other hand, personal computers, tablets, and mobile phones can deploy the first, second, and / or third models mentioned above.

[0097] It should be understood that models deployed on electronic devices are generally small in scale, simple in function, and usually have a fast inference speed.

[0098] The kernel layer is primarily responsible for the core functions of the system, including process management (such as creating, terminating, and invoking processes); thread management (such as coordinating the execution of multiple threads); memory management (such as allocating and reclaiming memory space); file system management (such as managing and storing files); and device drivers (such as enabling communication and control between the operating system and physical hardware). The kernel layer is a crucial part of the operating system.

[0099] For ease of explanation, Figure 3 The system also includes a hardware layer that interacts with the aforementioned system architecture. The hardware layer provides physical hardware support for the operating system. All software functions in the operating system depend on the support of the hardware layer to be implemented effectively. The hardware layer and the kernel layer interact through drivers to ensure smooth information exchange and precise control of the physical hardware.

[0100] In this embodiment, the main hardware components involved are CPU, iGPU, discrete GPU (if any), and NPU (equipped in some electronic devices). When iGPU cannot meet the performance requirements of model computation or when the model has high requirements for computing resources and efficiency, NPU is considered for use.

[0101] In this embodiment, the system service layer, inference platform layer, and model layer can better reflect the collaborative relationship of the model in the application of electronic devices, and jointly realize the control of the model operation.

[0102] It should be noted that, Figure 3 The inference platform and model shown are described using Windows operating system electronic devices as an example. For electronic devices with different operating systems, the inference platform and model involved may differ.

[0103] The power consumption control method provided in this application can be executed by the aforementioned electronic device (such as a personal computer, tablet computer, mobile phone, etc.), or by a functional module and / or functional entity within the electronic device capable of implementing the module's operation method. Furthermore, the solution provided in this application can be implemented through hardware and / or software, and the specific implementation can be determined according to actual usage requirements; this application does not impose any limitations. The following description uses an electronic device as an example, along with the accompanying drawings, to exemplarily illustrate the power consumption control method provided in this application.

[0104] The embodiments of this application will be described below with reference to the accompanying drawings and through several exemplary embodiments. The methods in the following embodiments can all be implemented in an electronic device having the above-described hardware structure and system architecture. The hardware structure diagram of the electronic device can be as follows: Figure 2 As shown, the system architecture block diagram of an electronic device can be as follows: Figure 3 As shown, the embodiments of this application are not limited thereto. For ease of explanation, the electronic device used in the embodiments of this application is a personal computer.

[0105] Figure 4 The diagram illustrates an application scenario to which an embodiment of this application applies. Figure 4 The application scenarios used in the embodiments of this application are described below. Taking the use of a smart search application on a personal computer as an example, the user enters text in the search area of ​​the smart search application to search for documents, such as... Figure 4 As shown in (a), the text entered in the search area 41 of the third search window 40 is "the development trend of YY". After the document control 42 in the third search window is clicked, a document search is performed. At this time, the intelligent search application performs a reasoning task by loading the model deployed in the personal computer. The reasoning task is a preset reasoning process in the intelligent search application, which may include key information extraction, summary extraction, semantic analysis and information slot extraction, etc., and obtains the results corresponding to each reasoning task, and displays the semantically analyzed search results in the first display area 43 of the third search window 40.

[0106] like Figure 4 As shown in (b), after clicking on a search result "Development Analysis Report" in the first display area 43, the user can view the specific content of the "Development Analysis Report" document; such as Figure 4 As shown in (c), a second display area 44 is presented in the third search window 40 for previewing the document, and a sub-area 45 in the second display area 44 displays the search results extracted from the summary.

[0107] The intelligent search application can also perform searches for images, videos, audio, folders, etc. It should be understood that the semantic search process for each type will also involve the execution of inference tasks by loading models deployed on a personal computer.

[0108] It should also be understood that during the use of a personal computer, other applications can also trigger the loading of models deployed on the personal computer for inference tasks. This application embodiment does not limit the visual design, information presentation, etc. of triggering model loading and performing inference tasks in various applications.

[0109] The following is combined Figures 5 to 9 The power consumption control method provided in the embodiments of this application will be described in detail. Figure 5 This illustration shows a flowchart of a power consumption control method provided in an embodiment of this application. This method is applied to electronic devices, such as... Figure 5 As shown, the power consumption control method provided in this application includes the following steps:

[0110] S310, in response to the first operation, load the preset model.

[0111] It should be understood that a preset model is a model deployed on an electronic device; the preset model is installed and stored on the electronic device and can run on the electronic device.

[0112] A preset model can refer to one or more models such as a language model, an image recognition model, or a multimodal model. It should be understood that in the process of an electronic device implementing a corresponding function through a preset model, one model or multiple models may be involved.

[0113] The first operation is used to trigger the target model. When the electronic device executes the target function, it runs the preset model. In other words, the implementation of the target function requires loading the preset model so that the electronic device can execute the corresponding reasoning task through the preset model.

[0114] It should be noted that the target function can include speech recognition, image recognition, semantic search, target detection, language translation, etc. Therefore, operations in many situations will trigger the target function, such as the various scenarios listed below:

[0115] First, when an application starts up; when some applications on an electronic device are launched and begin running, and the application needs to rely on a relevant preset model to achieve its corresponding function, the target function will be triggered. For example, when an application with image recognition is launched, and the application completes inference tasks such as image classification and object detection based on a preset model, the corresponding target function will be triggered when the image recognition application starts, ensuring that the application analyzes and processes the image.

[0116] Secondly, specific input events are triggered when a user inputs voice or text data into applications on an electronic device. When this input data needs to be semantically analyzed, understood, or processed using a pre-defined model to generate a corresponding response or result, the corresponding target function will also be triggered. Similarly, when an electronic device collects data through sensors (such as cameras and microphones) and processes this data using a pre-defined model for target recognition and behavior analysis, the corresponding target function will also be triggered.

[0117] Third, when a functional module is invoked; when a user clicks or triggers a functional module in an application, and that functional module implements its specific function based on a preset model, the corresponding target function will be triggered, and the preset model will be loaded into memory. For example, in a document editing application, when a user clicks the intelligent writing assistant function, and that function implements text generation, grammar checking, and other functions based on a preset model; or when searching for documents in an intelligent search application, the corresponding target function will be triggered.

[0118] Fourth, scheduled tasks or periodic operations; when the operating system or application of an electronic device is set to scheduled tasks, and an operation related to a preset model needs to be performed at a specific time interval or point in time, the corresponding target function will be triggered so that the preset model is loaded into memory. For example, a health monitoring application needs to analyze and evaluate the user's physiological data (such as heart rate, blood pressure, etc.) through a preset model every hour. When the scheduled time arrives at each hour, the corresponding target function will be triggered.

[0119] Fifth, when a specific scenario or condition is detected, the electronic device will trigger the corresponding target function to load the preset model into memory. For example, if the environmental sensor in a smart home device detects that the indoor light intensity is below the light intensity threshold and that there is human activity, and the lighting of the smart home device is controlled based on a preset model, the corresponding target function will be triggered.

[0120] It should be understood that the first operation that triggers the target function can be one or more of the above scenarios, and the embodiments of this application do not limit the type of scenario for triggering the target function used to indicate loading the preset model.

[0121] for Figure 4 In the example shown in (a), the target function is triggered by the user's input text and the clicking of the document control, that is, the target function is triggered and a preset model needs to be loaded; that is, the corresponding document semantic search service starts at this time (i.e. the target function is triggered) and the preset model is loaded, where the preset model can be a language model.

[0122] S320: Detect the resources and operating status of electronic devices to obtain target resource data.

[0123] Among them, the target resource data reflects the results of current monitoring of the resources and operating status of electronic devices.

[0124] It should be understood that if the corresponding inference task is performed directly based on the preset model after the preset model is loaded, it may cause the corresponding processor load to be too high, such as the iGPU load reaching 90% or more, thereby increasing the power consumption of the electronic device. Therefore, in this embodiment, before executing a specific inference task through the preset model, the resources and operating status of the electronic device are detected, and the detected target resource data is analyzed to determine the maximum number of inference tasks that the processor can execute. This ensures that when the processor executes an inference task equal to or less than the maximum number of inference tasks, the power consumption of the electronic device can be maintained at a relatively stable level. By limiting the number of inference tasks, the power consumption of the electronic device can be effectively prevented from increasing.

[0125] It should be understood that during the inference task processing of different data through the model, due to the difference in data volume, the power consumption of electronic devices can sometimes be maintained at a relatively stable level, and sometimes it may be reduced.

[0126] Among them, the resources of electronic devices mainly refer to the utilization of hardware in the system. Hardware such as CPU, GPU, NPU, and memory are key hardware computing resources in electronic devices. Their status directly reflects the degree of resource utilization and can comprehensively reflect the efficiency and quality of electronic devices in completing various tasks. In the application scenarios involved in the embodiments of this application, resources mainly refer to processing power (such as CPU, GPU, etc.) and storage performance (such as memory).

[0127] The monitoring of the GPU includes the monitoring of the iGPU and / or GPU. In this embodiment, the monitoring of the iGPU is the primary focus.

[0128] It should be understood that if the model's inference task involves an iGPU, then the iGPU will be detected; if the model's inference task involves an NPU, then the NPU will be detected; if the model's inference task involves both an iGPU and an NPU, then both the iGPU and the NPU will be detected.

[0129] The operating state of an electronic device refers to the various aspects that characterize its working characteristics and conditions during the collaborative work of its components. In the application scenarios involved in the embodiments of this application, the operating state mainly refers to the temperature of the electronic device (such as the casing temperature, ambient temperature, etc.) and the power supply method (such as plug-in status).

[0130] Taking personal computers as an example, their power supply methods include AC power (plugged-in) and battery power (DC). In AC power mode, personal computers typically perform at their best because the power adapter provides relatively ample power, allowing hardware components such as the processor and graphics card to operate at higher power. In DC power mode, to extend battery life, personal computers usually automatically adjust hardware performance, such as reducing processor frequency and screen brightness.

[0131] It should be understood that when running the model, a personal computer in AC mode can maintain a high CPU and GPU frequency, reducing performance degradation due to insufficient power.

[0132] For example, detecting the resources and operating status of electronic devices includes detecting the power supply method, temperature, and CPU / GPU components to obtain target resource data; specifically, GPU detection includes iGPU detection. In other words, the resources and operating status of electronic devices include their power supply method, temperature, and the CPU, GPU, and memory components.

[0133] It should also be understood that the processors involved in electronic devices vary. For example, some electronic devices use CPUs and iGPUs, while others use CPUs, iGPUs, and NPUs. Therefore, the target resource data corresponding to the resources and operating states of different electronic devices will also differ. In some embodiments, the resources and operating states of an electronic device include its power supply method, temperature, and the CPU, GPU, and NPU within the device.

[0134] It should be understood that the target resource data obtained from detecting the resources and operating status of electronic devices is determined by an inference prediction model. This inference prediction model is used to determine the theoretical number of times the current resources and operating status of the electronic device can support the execution of the inference task.

[0135] It should be noted that electronic devices have different requirements for power consumption and resource usage. For different types of electronic devices, or electronic devices of the same type but different models, the corresponding inference prediction models are different. Therefore, the inference prediction models in different electronic devices are modeled based on the theoretical number of inference predictions.

[0136] S330. Input the target resource data into the inference prediction model to obtain the theoretical number of inferences.

[0137] The theoretical inference count is the maximum number of inference tasks that the target resource data can support through a preset model. In other words, during the execution of the inference tasks corresponding to the theoretical inference count, the power consumption of the electronic device can remain at a relatively stable level.

[0138] It should be understood that the inference prediction model is a pre-trained computational model whose input data is the target resource data and whose output data is the theoretical number of inferences.

[0139] In order to suppress the continuous increase of power consumption of electronic devices when performing task inference through preset models, the resources and operating status of electronic devices are detected, thereby limiting the number of inference tasks executed. Therefore, in order to obtain the theoretical number of inferences that electronic devices can support the preset model to execute inference tasks, the inference prediction model is modeled through the following steps (1)-(6). This modeling is described using the resources and operating status of electronic devices, including the power supply method of electronic devices, the temperature of electronic devices, and the CPU and GPU in electronic devices as examples.

[0140] (1) Obtain multiple initial data from the electronic device. Each initial data includes the plug-in status of the electronic device, CPU load, GPU load, case temperature, ambient temperature, and theoretical inference count.

[0141] It should be understood that different types of electronic devices, or electronic devices of the same type but different models, have different initial data. Therefore, when modeling, it is necessary to obtain the corresponding initial data based on the electronic device.

[0142] Furthermore, the initial data is used to train the inference prediction model, so the amount of initial data needs to meet the training requirements, for example, 100 initial data points, or even more.

[0143] The casing temperature and ambient temperature are obtained through corresponding temperature sensors, and the ambient temperature can also be preset according to time.

[0144] (2) Normalize the feature data in the initial data to eliminate the influence of dimensions.

[0145] The feature data includes plug-in status, CPU load, GPU load, chassis temperature, and ambient temperature. The range and distribution of these feature data may vary. By normalizing the feature data of the input model, all feature data can be mapped to a similar interval, so that the model can treat each feature data in a fairer way during training.

[0146] For example, the minimum-maximum normalization method can be used to process the data, and the feature data can be normalized using the following formula:

[0147]

[0148] In the formula, This refers to one of the following features: power-on status, CPU load, GPU load, chassis temperature, and ambient temperature. It is the raw data for that feature. The minimum value of this feature data. The maximum value of this feature data. This is the normalized data for this feature.

[0149] (3) Establish a multiple linear regression model to obtain the initial inference model.

[0150] By exploring the relationships between characteristic data and the number of theoretical inferences for prediction through multiple linear regression analysis, an initial inference model is obtained.

[0151] Specifically, the initial inference model takes the following form:

[0152]

[0153] In the formula, For the number of theoretical inferences, The data is normalized based on the plug-in state. This is the data after CPU load normalization. This is data normalized for GPU load. This is the normalized data for the casing temperature. The data is normalized to ambient temperature. For the intercept term, The regression coefficients for the plugged-in state are... The regression coefficient for CPU load is . The regression coefficients for GPU load are denoted as . The regression coefficient for the casing temperature is . The regression coefficient for ambient temperature is... This is the error term.

[0154] It should be understood that in the formula , , , , , and It is unknown and needs to be determined by training the initial inference model with initial data.

[0155] (4) Train the initial inference model in (3) based on the training data in the initial data to obtain , , , , , .

[0156] It should be understood that training data is obtained by dividing the initial data according to a preset ratio, such as 8:2, to obtain the training set (i.e., training data) and the test set.

[0157] (5) Use the least squares method for regression analysis.

[0158] It should be understood that the goal of the least squares method is to minimize the loss function, thereby determining the optimal model parameters. In regression analysis, the loss function measures the difference between the test values ​​and the true values, and thus determines the combination of model parameters that minimizes this difference. The loss function is as follows:

[0159]

[0160] In the formula, For the sum of squared errors, For the amount of training data, For the first The number of theoretical inferences in the training data. For the first The plugging status in the training data, For the first CPU load in the training data For the first GPU load in the training data For the first The casing temperature in the training data. For the first The ambient temperature in the training data.

[0161] It should also be understood that It is an important indicator for evaluating the goodness of fit of the initial inference model. The smaller the value, the smaller the difference between the model's predicted value and the actual value, and the better the model fits the data. Therefore, if If L is greater than or equal to the error threshold, the model parameters need to be adjusted through the above steps (3) and (4). If L is less than the error threshold, the candidate inference model is obtained through the corresponding model parameters.

[0162] (6) Use the test data in the initial data to evaluate the alternative inference model, calculate the error between the predicted value and the actual value, evaluate the fitting effect of the model, and obtain the target inference model.

[0163] It should be understood that the target inference model is the inference prediction model in the above embodiments, which is used to predict the theoretical inference number in the power consumption control method.

[0164] It should also be understood that in specific application scenarios, there may be a need to detect the resources and operating status of different electronic devices in order to obtain the corresponding target resource data; for example, memory monitoring may also be required; and for example, if the preset model involves the NPU when performing inference tasks, then the target resource data corresponding to the NPU may also be involved when modeling the corresponding inference model. Therefore, in application scenarios involving the resources and operating status of different electronic devices, the modeling method described in steps (1)-(6) above can also be used to model the corresponding inference prediction model.

[0165] S340. When the number of theoretical inferences is greater than zero, perform the target inference task based on the preset model.

[0166] The target reasoning task is determined by the theoretical number of reasoning attempts. The target reasoning task can be a reasoning task corresponding to the theoretical number of reasoning attempts, or a reasoning task corresponding to the theoretical number of reasoning attempts as the upper limit.

[0167] In other words, the number of target reasoning tasks is less than or equal to the number of theoretical reasoning tasks.

[0168] By detecting the resources and operating status of electronic devices and analyzing the detected target resource data, the maximum number of inference tasks that the processor can execute, i.e., the theoretical number of inferences, is determined. This enables the electronic device to execute the target inference tasks corresponding to the theoretical number of inferences. Thus, when the processor in the electronic device executes these target inference tasks, it can achieve reasonable control and optimization of the power consumption of the electronic device, thereby improving the user experience.

[0169] The above embodiments focus on describing the target resource data obtained by detecting the resources and operating status of electronic devices, and the reasoning based on this target resource data to obtain the number of inference tasks that the target resource data supports for execution through a preset model, thereby improving the phenomenon of excessive processor load. The following will... Figure 6 The illustrated embodiment describes in detail how to perform the corresponding reasoning task, i.e. the target reasoning task, based on the theoretical number of reasoning attempts.

[0170] Figure 6 The following is a flowchart illustrating another power consumption control method provided in an embodiment of this application, as shown below. Figure 6 As shown, the power consumption control method provided in this application includes the following steps:

[0171] S410, in response to the first operation, load the preset model.

[0172] S420: Detect the resources and operating status of electronic equipment to obtain target resource data.

[0173] S430. Input the target resource data into the inference prediction model to obtain the theoretical number of inferences.

[0174] S440. When the theoretical inference count is zero, no inference task is performed, and the resources and operating status of the electronic device are detected based on a preset first monitoring frequency to obtain updated target resource data.

[0175] It should be understood that when the number of theoretical inferences is zero during an analysis, it indicates that the electronic device is not ready to perform the inference task and needs to suspend the inference task. Based on the preset first monitoring frequency, the resources and operating status of the electronic device should continue to be monitored to obtain updated target resource data.

[0176] It should be understood that by cyclically monitoring the resources and operating status of electronic devices through a preset first monitoring frequency, dynamic monitoring of electronic devices can be achieved to determine whether the electronic devices meet the requirements for performing inference tasks; for example, the resources and operating status of electronic devices are monitored once every 5 seconds, and once every 6 seconds.

[0177] It should be understood that the preset first monitoring frequency is determined by the data points related to various resources and operating status, while ensuring the normal operation of the electronic equipment, and the preset first monitoring frequency will not affect the normal operation of the electronic equipment.

[0178] The resources and operating status of electronic devices include the power supply method, temperature, and multiple or all data from the CPU, GPU, NPU, etc. Different data correspond to different monitoring frequencies. Therefore, it is necessary to comprehensively consider the monitored data to determine the preset first monitoring frequency.

[0179] It should be understood that, when the theoretical inference count is zero, continuous monitoring of the resources and operating status of electronic devices facilitates the timely execution of inference tasks when the resources and operating status of the electronic devices support the execution of inference tasks, thereby improving the stability of the system.

[0180] S450. When the number of theoretical inferences is greater than zero, determine the target inference task to be executed by the preset model based on the number of theoretical inferences.

[0181] It should be understood that the inference tasks performed by the preset model, i.e., all the candidate inference tasks involved in the initial inference task queue, are determined by the application scenario corresponding to the target function. The initial inference task queue contains multiple candidate inference tasks. For example, in the document search application scenario mentioned above, the corresponding initial inference task queue includes candidate inference tasks such as key information extraction, summary extraction, and information slot extraction.

[0182] Based on the functional requirements corresponding to the application scenario, the candidate reasoning tasks are arranged in order of priority to obtain the initial reasoning task queue. Then, the first N candidate reasoning tasks in the initial reasoning task queue are used as the target reasoning tasks, where N is a positive integer less than or equal to the theoretical number of reasoning attempts.

[0183] For example, the candidate inference tasks in the initial inference task queue are sorted in descending order of priority. For instance, in the document search example above, the initial inference task queue includes key information extraction, summary extraction, and information slot extraction, etc. The priorities of each candidate inference task in the initial inference task queue are shown in the table below:

[0184] Table 1. Details of the Initial Inference Task Queue

[0185]

[0186] In Table 1, when the priority is 1, the corresponding priority level is the highest.

[0187] It should be understood that the target reasoning task is a candidate reasoning task obtained from the initial reasoning task queue according to the theoretical number of reasoning attempts. In other words, the tasks are obtained sequentially from high priority to low priority in the initial reasoning task queue until the number of reasoning tasks obtained reaches the theoretical number of reasoning attempts. The reasoning task obtained then becomes the target reasoning task.

[0188] Alternatively, the target reasoning task is a candidate reasoning task obtained from the initial reasoning task queue with fewer theoretical reasoning attempts than the theoretical number of attempts.

[0189] For the initial inference task queue shown in Table 1, if the theoretical number of inferences is 1, the target inference task is key information extraction. If the theoretical number of inferences is 2, there can be two target inference tasks, namely key information extraction and summary extraction. The target inference task can be one, namely key information extraction.

[0190] S460, Execute target reasoning tasks based on preset models.

[0191] The target reasoning tasks are executed sequentially in descending order of priority.

[0192] It should be understood that the target inference task is determined after fully considering the current resources and operating status of the electronic device. As a result, when the electronic device executes the target inference task through the preset model, the processor load can be in a more suitable state, thereby optimizing the processor performance, accelerating the efficiency of inference task processing, and improving the multi-task parallel processing capability. At the same time, it enhances the stability of the electronic device and achieves reasonable control and optimization of power consumption.

[0193] To ensure the smooth execution of the target inference task and the rational use of hardware resources, the resources and operating status of the electronic equipment are monitored in real time during the execution of the target inference task. That is, after step 450, the following steps are also included:

[0194] S470. During the execution of the target inference task, based on the preset first monitoring frequency, the resources and operating status of the electronic equipment are continuously monitored to obtain updated target resource data.

[0195] It should be noted that the updated target resource data is input into the inference prediction model to obtain the updated theoretical inference count. If the theoretical inference count corresponding to the updated target resource data is zero, the target inference task is stopped, thus making reasonable use of hardware resources. If the theoretical inference count is greater than zero, the target inference task continues to be executed to ensure the smooth execution of the target inference task.

[0196] To improve the accuracy of target resource data, the number of samples per unit time can be increased each time the resources and operating status of electronic devices are detected, and the average value of these sampled data can be calculated. This average value is then used as the target resource data.

[0197] In other words, each time the resources and operating status of an electronic device are detected, the resources and operating status of the electronic device are sampled M times within a unit of time to obtain M sets of sampled data. The average value of the M sets of sampled data is calculated, and this average value is the target resource data.

[0198] Where M is a positive integer, such as 5, 10, etc.

[0199] For example, each time the resources and operating status of an electronic device are detected, 10 samples are taken within a unit of time of 1 second to obtain 10 sets of sampled data. The average value of these 10 sets of sampled data is then calculated to obtain the target resource data for this detection of the electronic device's resources and operating status.

[0200] For details on the implementation of steps 410 to 430, please refer to the detailed description of steps 310 to 330 above, which will not be repeated here.

[0201] It should be noted that by adding real-time monitoring of the resources and operating status of electronic devices during the execution of the target inference task, and by taking the average of multiple samples each time the resources and operating status of electronic devices are detected, the performance of the processor in the power consumption control process is optimized, the accuracy of the power consumption control method is improved, and the user's experience with electronic devices is enhanced.

[0202] It should be understood that before performing inference tasks using a preset model, the preset model needs to be loaded into memory. To further improve and optimize the execution of inference tasks using the preset model, in some embodiments, memory monitoring is also included before loading the preset model as described in the above embodiments. Figure 7 The following is a flowchart illustrating another power consumption control method provided in an embodiment of this application, as shown below. Figure 7 As shown, the power consumption control method provided in this application includes the following steps:

[0203] S510, in response to the first operation, monitors the memory of the electronic device based on a preset second monitoring frequency to obtain the memory usage rate.

[0204] Memory refers to the components in electronic devices used to store running programs and data, such as... Figure 2 The image shows RAM in an electronic device. Memory capacity determines how many programs and data an electronic device can process simultaneously. For example, a personal computer with 8GB of RAM means it can store 8GB of data and run programs of that size in memory.

[0205] In this embodiment of the application, when the preset model is running, it is necessary to first read the file corresponding to the preset model from the hard disk and then load the preset model into memory. This is because the read and write speed of the hard disk is relatively slow, while the read and write speed of the memory is faster.

[0206] Taking the use of intelligent search applications on a personal computer as an example, when an image recognition application based on a preset model is launched, the file corresponding to the preset model (including the model's parameters, structure, and other information) will be read from the personal computer's hard drive into memory. Therefore, the corresponding processor can quickly access the data in the preset model, thereby performing efficient reasoning tasks.

[0207] It should be understood that the above process requires a certain amount of memory. Insufficient memory may lead to loading failures or slow system operation. High memory usage can also degrade the performance of electronic devices. Therefore, it is necessary to monitor memory usage before loading the preset model.

[0208] The preset second monitoring frequency is determined by information such as the hardware resources and memory fluctuations of the electronic device. The preset second monitoring frequency varies for different types and models of electronic devices. The preset second monitoring frequency may be the same as or different from the preset first monitoring frequency.

[0209] It should also be understood that setting a second monitoring frequency will not affect the normal operation of electronic devices. For example, monitoring the memory of electronic devices once every 3 seconds or monitoring the memory status of electronic devices once every 5 seconds.

[0210] S520. If the memory usage rate is less than the preset threshold, load the preset model.

[0211] The preset threshold is determined by the memory capacity of the electronic device and the size of the preset model.

[0212] It should be understood that the memory capacity varies between different types of electronic devices, or between different models of the same type of electronic device. Therefore, the memory capacity is determined by the corresponding hardware in the electronic device.

[0213] Furthermore, the sizes of the preset models vary; for example, there are models suitable for simple tasks and models used for complex artificial intelligence tasks. Therefore, by monitoring memory capacity, it can be determined whether the memory in the electronic device has enough space to store the preset models.

[0214] As shown in the example above, the first model is a large language model on the edge with 3B parameters. Since the number of parameters is a key factor affecting the model size, the first model may require 6GB of memory. Therefore, the preset threshold also needs to take into account the size of the preset model.

[0215] Therefore, the preset threshold is less than the memory capacity and can satisfy the requirement of loading the preset model into memory. By limiting the memory capacity through the preset threshold, it is ensured that there is enough space in memory to load the preset model, thereby increasing the probability of the preset model being loaded successfully and reducing the occurrence of electronic device lag, response delay, and other issues.

[0216] In addition, if the memory usage rate is greater than or equal to a preset threshold, the loading of the preset model will not be performed, and the memory of the electronic device will be monitored based on a preset second monitoring frequency to obtain the updated memory usage rate.

[0217] For example, the total memory capacity of a personal computer is 32GB, and the corresponding preset threshold can be 50%. If the memory usage rate is 32%, which is less than 50%, the preset model is loaded; if the memory usage rate is 58%, which is greater than or equal to 50%, the preset model is not loaded, and the memory of the electronic device is periodically monitored based on a preset second monitoring frequency.

[0218] In some embodiments, memory usage can also be monitored. For example, if the total memory capacity of a personal computer is 32GB, the corresponding preset threshold could be 16GB. If the memory usage is 8GB, which is less than 16GB, a preset model is loaded.

[0219] S530: Detect the resources and operating status of electronic devices to obtain target resource data.

[0220] S540. Input the target resource data into the inference prediction model to obtain the theoretical number of inferences.

[0221] S550: When the theoretical inference count is zero, no inference task is performed, and the resources and operating status of the electronic device are detected based on a preset first monitoring frequency to obtain updated target resource data.

[0222] S560. When the number of theoretical inferences is greater than zero, determine the target inference task to be executed by the preset model based on the number of theoretical inferences.

[0223] S570, Execute target reasoning tasks based on preset models.

[0224] S580. During the execution of the target inference task, based on the preset first monitoring frequency, the resources and operating status of the electronic equipment are continuously monitored to obtain updated target resource data.

[0225] For details on the implementation of steps 530 to 580, please refer to the detailed description of steps 420 to 470 above, which will not be repeated here.

[0226] Before loading the preset model, this application embodiment adds monitoring of the electronic device's memory, which can determine in advance whether the electronic device has enough space to accommodate the preset model, avoiding loading failure of the preset model due to insufficient memory; at the same time, it can prevent the already insufficient memory situation from being further aggravated by loading the preset model, thereby causing system performance degradation or even crash; it can also provide a basis for optimizing the preset model, such as determining whether the preset model needs to be compressed to match the memory capacity.

[0227] It should be understood that the target function includes multiple functions. Among them, some primary functions require running a preset language model on the electronic device during execution. For example, the semantic search function requires a preset language model, and the corresponding function is achieved by running the preset language model. The preset language model can be a language model or a multimodal model.

[0228] Taking semantic search in a smart search application on a personal computer as an example, in this application scenario, the first function is a semantic search service triggered by the user's voice or text input; in this embodiment of the application, the above power consumption control method specifically includes the following steps (1)-(6):

[0229] (1) In response to the second operation, the memory of the personal computer is monitored based on a preset second monitoring frequency to obtain the memory usage rate. The second operation is used to trigger the first function.

[0230] (2) Load the preset language model when the memory usage rate is less than the preset threshold.

[0231] (3) Detect the CPU load, GPU load and other resources in the personal computer, as well as the power-on status, case temperature and other operating status, to obtain the first resource data of the personal computer.

[0232] (4) Input the first resource data into the pre-established inference prediction model to obtain the first inference count supported by the first resource data. The inference prediction model is a model trained based on the first resource data such as CPU load, GPU load, plug-in status, and chassis temperature in the personal computer and the corresponding theoretical inference count.

[0233] It should be understood that the first inference count is the maximum number of inference tasks executed corresponding to the first resource data.

[0234] (5) If the first inference count is 0, the inference task is not executed (the first inference count obtained when monitoring the resources and operating status of the personal computer when the inference task is not executed), or the inference task is stopped (the updated first inference count obtained when monitoring the resources and operating status of the personal computer when the first inference task is executed), and the CPU load, GPU load and other resources in the personal computer, as well as the power-on status, case temperature and other operating status, are monitored based on the preset first monitoring frequency, and the first resource data is updated.

[0235] (6) If the first reasoning count is greater than 0, then the reasoning task corresponding to the first reasoning count is obtained from the initial reasoning task queue, that is, the first reasoning task.

[0236] In some embodiments, the number of first inference tasks may be equal to or less than the number of first inferences.

[0237] It should be understood that during the execution of the first inference task by the personal computer using a preset language model, the computer's resources, such as CPU load and GPU load, as well as its operating status, such as power-on status and chassis temperature, will be continuously monitored in real time. If the inference conditions are not met, the execution of the target inference task will be stopped immediately. The inference condition is that the number of inference attempts in the first attempt is greater than zero.

[0238] The use of pre-defined language models in semantic search is primarily to better understand user intent, generate high-quality results, and enable functions such as document search, image search, question answering, and dialogue. This provides rich and reasonable search content, thereby improving the accuracy, efficiency, intelligence, and diversity of search results.

[0239] This application embodiment periodically monitors the power-on status, chassis temperature, CPU load, and GPU load of a personal computer, and calculates the theoretical number of inferences based on the target resource data obtained from the monitoring. It then retrieves target inference tasks from the initial inference task queue for execution, enabling the personal computer to execute the corresponding target inference tasks based on a preset language model. At this time, the processor in the personal computer, especially the iGPU load, is in a more suitable state when executing these target inference tasks, thereby reducing power consumption and improving the user experience.

[0240] It should be noted that the preset model involved in the embodiments of this application is an edge-side model. The hardware conditions of the electronic device used, the number of parameters in the model, and model compression during operation may all lead to a decrease in the accuracy of the preset language model. In particular, when the preset language model in the preset model has low accuracy, during the execution of reasoning tasks, especially during keyword extraction, there will be repeated extraction of keywords, which will lead to the reasoning task failing to obtain a reasoning result.

[0241] To address the aforementioned issue leading to poor keyword inference performance, in application scenarios involving semantic search, the power consumption control method described above further includes the following steps when performing the target inference task based on a preset model:

[0242] First, if the target reasoning task is keyword extraction, determine the extracted queue text.

[0243] Secondly, if the length of the queue text is greater than or equal to the length of the record text, the corresponding target inference task will be stopped.

[0244] The recorded text can be either user-inputted speech, which is then recognized by Automatic Speech Recognition (ASR) to obtain the text, or user-inputted text.

[0245] After stopping the corresponding target reasoning task, the recorded text can be reasoned again using a preset language model.

[0246] It should be understood that if the length of the queue text is less than the length of the record text, the corresponding target inference task will continue to be executed.

[0247] In this embodiment of the application, during the reasoning process where the target reasoning task is keyword extraction, the extracted queue text and record text are first compared. By analyzing the queue text, the efficiency of performing the target reasoning task through the preset language model is improved, and the accuracy of the reasoning is also improved.

[0248] In some embodiments, the system architecture of the electronic device is as follows: Figure 3As shown, this includes a resource monitoring module. When a target function is triggered in the electronic device, the resource monitoring module performs specific adjustments. Figure 8 This illustration shows a flowchart of power consumption control implemented through a resource monitoring module according to an embodiment of this application. Figure 3 The power consumption control method provided in the embodiments of this application is described in detail in combination with the system architecture of a personal computer.

[0249] like Figure 8 As shown, in the application layer, when the target function is triggered, the resource monitoring module in the system service layer will adjust whether to load the preset model and the number of executable inference tasks to maintain the power consumption of the electronic device at a relatively stable level, reduce the power consumption of the electronic device, and improve the user experience.

[0250] Specifically, the resource monitoring module in the system service layer performs the following steps:

[0251] S610 monitors memory usage to obtain information on memory consumption.

[0252] Does the memory usage meet the criteria for high usage, such as a memory usage rate greater than or equal to a preset threshold?

[0253] S620: If memory usage is high, continue to monitor memory at a preset second monitoring frequency; for example, monitor memory every 5 seconds.

[0254] S630: If memory usage is low, load the preset model.

[0255] The pre-loaded models are obtained from the model layer through the inference platform in the inference platform layer. For example, the first language model, second language model, and / or third language model in the model layer are deployed on hardware such as iGPUs and NPUs through OpenVino, QNN, and / or TensorRT in the inference platform layer.

[0256] It should be understood that, Figure 8 The kernel layer content is omitted.

[0257] After the preset model is loaded, the resource monitoring module will continue to perform the following steps:

[0258] S640 detects the resources (CPU load, GPU load) and operating status (plug-in status, case temperature) of electronic devices to obtain target resource data.

[0259] S650: Input the target resource data into the inference prediction model and output the theoretical inference count.

[0260] S660. When the theoretical reasoning count is zero, the reasoning task is suspended.

[0261] S670. Continue to monitor the resources and operating status of the electronic device at a preset first monitoring frequency; for example, monitor the resources and operating status of the electronic device every 5 seconds.

[0262] It should be understood that at this time, the resources of the electronic device are insufficient to execute the inference task, and the inference task has not been executed through the preset model. Therefore, the inference task is temporarily put aside and not processed until the number of subsequent theoretical inferences is greater than zero, at which point it will be scheduled for execution.

[0263] S680. When the number of theoretical inferences is greater than zero, determine the number of inference tasks that match the number of theoretical inferences from the inference task queue, i.e., the target inference task, and then execute the target inference task through the preset model.

[0264] S690. During the execution of the target inference task, the resources and operating status of the electronic device will continue to be monitored at a preset first monitoring frequency of once every 5 seconds. If the inference conditions are not met, the inference will stop.

[0265] It should be understood that "not meeting the inference conditions" means that by continuing to monitor the resources and operating status of the electronic device at a preset first monitoring frequency, the number of theoretical inferences obtained after the update is zero.

[0266] In this embodiment, the memory of the electronic device is first monitored. When the memory is low, a preset model is loaded. Then, the resources and operating status of the electronic device are detected to obtain the target resource data corresponding to the detection. This data is then analyzed to obtain the theoretical number of inferences. The electronic device then executes the inference task corresponding to the theoretical number of inferences. Thus, when the processor in the electronic device executes these inference tasks, it achieves reasonable control and optimization of the power consumption of the electronic device, thereby improving the user experience.

[0267] In some embodiments, in order to implement the power consumption control process, the electronic device further includes a function service module and an inference engine module. The function service module is a module in the application layer, and the inference engine module is a module in the system service layer. When the target function is triggered in the electronic device, the function service module sends the loading of the preset model to the inference engine module. The inference engine module is used for process control of running the preset model, and the resource monitoring module is used to execute the specific control process. Figure 9 A flowchart illustrating another power consumption control method provided in an embodiment of this application is shown.

[0268] The following is through Figure 9 The illustrated embodiment will be described in detail when the user clicks... Figure 4 After executing the search result "Development Analysis Report" in the first display area 43 shown in (b), Figure 9 The power consumption control method shown can then achieve... Figure 4 The result shown in (c) is that the second display area 44 is presented in the third search window 40 to preview the search results, and the sub-area 45 in the second display area 44 displays the summary extracted search results.

[0269] like Figure 9 As shown, taking document search through the intelligent search application as an example, after performing a document search, the following is displayed: Figure 4 The search results shown in (a) are as follows. When a user clicks on a search result, "Development Analysis Report," in the first display area 43, as shown... Figure 4 As shown in (b) in the diagram, the target function was triggered.

[0270] S701. The functional service module obtains the document path and document status of the "Development Analysis Report" document.

[0271] The document path specifies the location where each document is stored, helping subsequent searches quickly find the document. For example, a document with the path "C:\User\……\XXX.pdf" can directly locate the document "XXX.pdf". The document status helps filter documents that meet specific user criteria. Common document statuses include "modification date", "encrypted", and "read-only". For example, if a user enters a document search query about recently modified documents related to YY's development, the "modification date" information can be obtained from the document status.

[0272] When searching for documents, information within the documents is often involved. Therefore, the S702 functional service module continues to perform parsing, cleaning, and risk control operations on the "Development Analysis Report" document.

[0273] It should be understood that by processing documents, the pre-defined model's analysis of document content can be improved, the efficiency of data processing can be increased, and the accuracy of model processing can be enhanced.

[0274] S703, the function service module will send the request for the preset model and the text content to the inference engine module.

[0275] S704, the inference engine module instructs the resource monitoring module to load the preset model.

[0276] The S705 resource monitoring module monitors memory.

[0277] S706. When memory usage is low (e.g., memory usage rate is less than a preset threshold), load the preset model through the inference platform.

[0278] S707, the inference platform returns the result of whether the preset model was successfully loaded to the inference engine module.

[0279] If the preset model is successfully loaded, execute S708, the inference engine module instructs the resource monitoring module to perform the inference task, and sends the text content to the resource monitoring module.

[0280] The S709 resource monitoring module monitors the temperature, power-on status, CPU load, and GPU load of electronic devices to obtain target resource data.

[0281] S710. Input the target resource data into the pre-established inference prediction model to obtain the theoretical number of inferences.

[0282] S711. Determine the target reasoning task in the initial reasoning task queue based on the theoretical reasoning number. It should be understood that the target reasoning task at this time includes summary extraction.

[0283] S712, the inference platform executes the target inference task based on the loaded preset model.

[0284] S713, The inference platform returns the results of the target inference task to the inference engine module.

[0285] S714 The inference engine module transmits the results of the target inference task to the functional service module and saves them.

[0286] S715. After completing the inference task, unload the preset model from memory.

[0287] The inference engine module transmits the extracted summary results to the functional service module and saves them. The functional service module then displays the content and summary of the "Development Analysis Report" document according to the functional requirements of the intelligent search application.

[0288] It should be understood that the above model call may involve more modules in the process of application, and the embodiments of this application do not limit the types and uses of the modules involved.

[0289] Through the above modules, during the power consumption control process, memory monitoring of electronic devices is achieved. When memory is low, a preset model is loaded. Then, the resources and operating status of electronic devices are detected, the corresponding target resource data is obtained and analyzed to obtain the theoretical inference count, so that the electronic device can execute the inference task corresponding to the theoretical inference count. In this way, when the processor in the electronic device executes these inference tasks, the power consumption of the electronic device can be reasonably controlled and optimized, thereby improving the user experience.

[0290] It should be noted that in the embodiments of this application, "greater than" can be replaced with "greater than or equal to", "less than or equal to" can be replaced with "less than", or "greater than or equal to" can be replaced with "greater than", and "less than" can be replaced with "less than or equal to".

[0291] It should be understood that the term "embodiment" used throughout this specification means that a specific feature, structure, or characteristic related to an embodiment is included in at least one embodiment of this application. Therefore, various embodiments throughout this specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.

[0292] It should also be understood that in this application, “when…”, “if” and “if” all refer to the electronic device making a corresponding processing under certain objective circumstances, and are not time-limited, nor do they require the electronic device to make a judgment when it implements the processing, nor do they imply any other limitations.

[0293] In this application, the use of singular pronouns to denote "one or more" rather than "one and only one," unless otherwise specified. In this application, unless otherwise specified, "at least one" is intended to mean "one or more," and "more than" is intended to mean "two or more."

[0294] It should be understood that the sequence numbers of the processes in the above embodiments do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention. The various embodiments described herein can be independent solutions or combinations based on internal logic, and all such solutions fall within the protection scope of this application.

[0295] It should also be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed 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 performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0296] Figure 10 A schematic diagram of a power consumption control device provided in an embodiment of this application is shown. This power consumption control device 800 can be used to perform the actions performed by the electronic device in the above method embodiments. For example... Figure 10 As shown, the power consumption control device 800 includes a loading model unit 810, a resource detection unit 820, and an inference unit 830.

[0297] The loading model unit 810 is used to load a preset model in response to the first operation. The first operation is used to trigger the target function. When the electronic device performs the target function, it runs the preset model. The preset model is deployed on the electronic device.

[0298] The resource detection unit 820 is used to detect the resources and operating status of electronic devices to obtain target resource data; and to input the target resource data into the inference prediction model to obtain the theoretical inference count, wherein the theoretical inference count is the number of inference tasks supported by the target resource data.

[0299] The reasoning unit 830 is used to execute the target reasoning task determined by the number of theoretical inferences through a preset model when the number of theoretical inferences is greater than zero.

[0300] The power consumption control device provided in this application embodiment is used to execute the power consumption control method of the above embodiment. The technical principle and technical effect are similar, and will not be described again here.

[0301] It should be understood that the power consumption control device can be a terminal device or a chip within the terminal device.

[0302] It should be noted that the power consumption control device of the above application is embodied in the form of a functional unit. The term "unit" here can be implemented in software and / or hardware, without specific limitation.

[0303] This application provides a computer program product that, when run on an electronic device, causes the electronic device to execute the technical solutions described in the above embodiments. Its implementation principle and technical effects are similar to those of the related embodiments described above, and will not be repeated here.

[0304] This application provides a readable storage medium containing instructions that, when executed by an electronic device, cause the electronic device to perform the technical solutions described in the above embodiments. The implementation principle and technical effects are similar and will not be repeated here.

[0305] The computer-readable storage medium and computer program product are used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects of the corresponding methods provided above, and will not be repeated here.

[0306] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0307] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0308] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0309] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0310] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0311] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0312] The same or similar parts between the various embodiments in this application can be referred to mutually. In the various embodiments of this application, and in the various implementation methods / methods / implementations within each embodiment, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments and between the various implementation methods / methods / implementations within each embodiment are consistent and can be mutually referenced. The technical features in different embodiments and the various implementation methods / methods / implementations within each embodiment can be combined according to their inherent logical relationships to form new embodiments, implementation methods, methods, or implementation approaches. The above embodiments of this application do not constitute a limitation on the scope of protection of this application.

[0313] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims. In conclusion, the above are merely preferred embodiments of the technical solution of this application and are not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A power consumption control method, characterized in that, Applied to an electronic device on which a preset model is deployed, the power consumption control method includes: In response to the first operation, the memory of the electronic device is monitored based on a preset second monitoring frequency to obtain the memory occupancy rate; If the memory usage rate is less than a preset threshold, the preset model is loaded, wherein the first operation is used to trigger the target function, so the electronic device runs the preset model when executing the target function; The resources and operating status of the electronic device are detected to obtain target resource data, wherein the resources are used to indicate the degree of hardware utilization in the electronic device, including CPU load and GPU load, and the operating status is used to indicate the working characteristics and conditions of the electronic device, including the temperature and power supply method of the electronic device; The target resource data is input into the inference prediction model to obtain the theoretical number of inferences. The inference prediction model is used to predict the number of inference tasks that the electronic device can support under the target resource data. The theoretical number of inferences is the maximum number of inference tasks that the target resource data can support to be executed through the preset model. When the number of theoretical inferences is greater than zero, a target inference task is executed based on the preset model, wherein the target inference task is determined by the number of theoretical inferences, and the number of target inference tasks is less than or equal to the number of theoretical inferences; During the execution of the target inference task, the resources and operating status of the electronic device are detected based on a preset first monitoring frequency to obtain updated target resource data; The updated target resource data is input into the inference prediction model to obtain the updated theoretical inference count. If the updated theoretical inference count is zero, the target inference task is stopped.

2. The power consumption control method according to claim 1, characterized in that, Before performing the target inference task based on the preset model, the following steps are also included: Obtain alternative reasoning tasks corresponding to the target function; The candidate reasoning tasks are arranged in descending order of priority to obtain the initial reasoning task queue; The first N candidate reasoning tasks in the initial reasoning task queue are taken as the target reasoning task, where N is a positive integer less than or equal to the theoretical number of reasoning attempts.

3. The power consumption control method according to claim 1, characterized in that, After the target resource data is input into the inference prediction model to obtain the theoretical number of inferences, the following steps are also included: When the theoretical inference count is zero, based on a preset first monitoring frequency, the inference tasks in the initial inference task queue are not executed, and the resources and operating status of the electronic device are detected to obtain updated target resource data.

4. The power consumption control method according to any one of claims 1 to 3, characterized in that, The process of detecting the resources and operating status of the electronic device to obtain target resource data includes: Each time the resources and operating status of the electronic device are detected, the resources and operating status of the electronic device are sampled M times within a unit time to obtain M sets of sampled data, where M is a positive integer; The target resource data is obtained by calculating the mean of the M groups of sampled data.

5. The power consumption control method according to any one of claims 1 to 3, characterized in that, The target function includes a first function, and the electronic device runs a preset language model when executing the first function. The power consumption control method includes: In response to the second operation, the preset language model is loaded, and the second operation is used to trigger the first function; The CPU load, iGPU load, plug-in status, and temperature of the electronic device are detected to obtain the first resource data; The first resource data is input into the inference prediction model to obtain the first number of inferences; If the first inference count is greater than zero, a first inference task is performed based on the preset language model, wherein the number of the first inference tasks is less than or equal to the first inference count.

6. The power consumption control method according to claim 5, characterized in that, During the execution of the first inference task by the preset language model, the following are also included: If the first reasoning task is keyword extraction, determine the extracted queue text; If the length of the queue text is greater than or equal to the length of the recorded text, the keyword extraction is stopped. The recorded text is the text obtained by speech recognition of the user's input when the first function is triggered, or the text input by the user.

7. The power consumption control method according to any one of claims 1 to 3, characterized in that, The electronic device includes a resource monitoring module, and the power consumption control method includes: In response to the first operation, the resource monitoring module loads the preset model; The resource monitoring module detects the resources and operating status of the electronic device to obtain target resource data; The resource monitoring module inputs the target resource data into the inference prediction model to obtain the theoretical number of inferences. When the number of theoretical inferences is greater than zero, the resource monitoring module performs the target inference task based on the preset model.

8. A power consumption control device, characterized in that, The power consumption control device includes a processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program from the memory, causing the power consumption control device to perform the method of any one of claims 1 to 7.

9. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, causes the processor to perform the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Queue resource adjustment method and device, electronic equipment and computer readable medium

    CN112231100A

  • Reasoning board card, reasoning method based on reasoning board card, equipment, medium and product

    CN119047584A