LSTM Inference Method and Electronic Device Based on Channel Pruning and Gating Configuration
By using an LSTM inference method based on channel pruning and gating configuration, the LSTM structure in the GNSS chip system is dynamically adjusted, solving the problems of redundancy and resource waste in multi-task LSTM structures, and achieving task adaptability and efficient resource utilization.
Patent Information
- Application Number
- CN202511748917.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-04-03
- Estimated Expiration
- 2045-11-26
AI Technical Summary
The LSTM inference model in GNSS chip systems suffers from problems such as redundancy in multi-task LSTM structures, lack of task-characteristic-driven structure adaptation mechanisms, difficulty in reusing multi-task structures, and lack of task adaptability in existing compression schemes.
By using an LSTM inference method based on channel pruning and gating configuration, the current task category and its state complexity level are determined according to the characteristic fluctuation range and historical state of the GNSS input signal. Hidden state channels are pruned and gating paths are configured, and the LSTM structure is dynamically adjusted to adapt to different task requirements.
It reduces redundancy in the multi-task LSTM structure, lowers computing resources and power consumption, improves ease of use and practicality, and achieves task adaptability and on-demand resource allocation.
Smart Images

Figure CN121212207B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of LSTM state computation technology, specifically to an LSTM inference method based on channel pruning and gating configuration, an electronic device, and a computer-readable storage medium. Background Technology
[0002] In GNSS (Global Navigation Satellite System) chip systems, to enhance robustness and navigation awareness in complex environments, an increasing number of intelligent tasks are being integrated into the receiver. LSTM (Long Short-Term Memory) networks are widely used in GNSS terminals for tasks such as satellite signal loss prediction and continuity assessment, broadband or multi-source GNSS interference trend modeling, and multipath reflection feature modeling and drift estimation.
[0003] The aforementioned tasks are characterized by different task objectives, similar model structures, interleaved state dimensions, and high degree of shared computational resources. In existing technologies, the LSTM inference model in GNSS chip systems suffers from redundancy in multi-task LSTM structures.
[0004] Therefore, how to reduce the redundancy of multi-task LSTM structures remains an unsolved problem. Summary of the Invention
[0005] The purpose of this application is to provide an LSTM inference method, electronic device, and computer-readable storage medium based on channel pruning and gating configuration, which can solve the problem of redundancy in the multi-task LSTM structure in the prior art.
[0006] In a first aspect, embodiments of this application provide an LSTM inference method based on channel pruning and gating configuration, the method comprising:
[0007] Acquire GNSS input signal;
[0008] Based on the characteristic fluctuation range and historical status of the GNSS input signal, determine the category of the current task and its status complexity level;
[0009] Based on the current task category and its state complexity level, the hidden state channel is pruned according to the pruning strategy selected from the task channel pruning strategy library, and the gating path is configured according to the LSTM gating configuration table.
[0010] Based on the pruned hidden state channels and the configured gating paths, perform LSTM inference corresponding to the current task.
[0011] In one possible implementation of the first aspect, the method further includes:
[0012] Based on the channel mask, the category of each task, and its state complexity level, a task channel pruning strategy library is constructed.
[0013] In one possible implementation of the first aspect, each task corresponds to a set of channel masks, each set of channel masks corresponds to an LSTM hidden state channel enable bitmap, and each channel mask is organized based on a two-dimensional table of the category to which each task belongs and its state complexity level.
[0014] In one possible implementation of the first aspect, the method further includes:
[0015] Based on the category and gating path of each task, an LSTM gating configuration table is constructed; each task is bound to a set of gating path configuration strategies.
[0016] In one possible implementation of the first aspect, the gating path configuration strategy includes:
[0017] Enable all gated paths; retain some gated paths and disable the rest; freeze some gated paths when the task status is stable.
[0018] In one possible implementation of the first aspect, the gating path includes: an input gate, a forget gate, an output gate, and a candidate state; retaining some gating paths and disabling the rest includes:
[0019] Retain the input gate and forget gate, and mask the output gate and candidate state; retain the input gate and output gate, and mask the forget gate and candidate state; retain the input gate and candidate state, and mask the forget gate and output gate; retain the forget gate and output gate, and mask the input gate and candidate state; retain the forget gate and candidate state, and mask the input gate and output gate; retain the output gate and candidate state, and mask the input gate and forget gate.
[0020] In one possible implementation of the first aspect, the method further includes:
[0021] With the forget gate and candidate states preserved, and the input and output gates masked, the state is updated according to the following calculation formula:
[0022]
[0023] in, This indicates the current state of the cell. t Indicates time, Represents the Gate of Oblivion This represents element-wise multiplication. This indicates the cell state at the previous moment. Indicates the candidate state;
[0024]
[0025] in, This indicates the hidden state at the current moment. This represents the hyperbolic tangent function.
[0026] In one possible implementation of the first aspect, the calculation formula for the forget gate is as follows:
[0027]
[0028] in, This represents the Sigmoid activation function. The weight matrix represents the forget gate. This indicates the hidden state at the previous moment. This represents the GNSS input signal at the current moment. Indicates to and Perform vector concatenation. Indicates the bias of the forget gate;
[0029] The formula for calculating the candidate state is as follows:
[0030]
[0031] in, The weight matrix representing the candidate states. This represents the bias of the candidate state.
[0032] Secondly, embodiments of this application provide an LSTM inference device based on channel pruning and gating configuration, the device comprising:
[0033] Acquisition unit, used to acquire GNSS input signals;
[0034] The determination unit is used to determine the category and state complexity level of the current task based on the characteristic fluctuation range and historical state of the GNSS input signal.
[0035] The processing unit is used to prune the hidden state channel according to the category of the current task and its state complexity level, based on the pruning strategy selected from the task channel pruning strategy library, and to configure the gating path based on the LSTM gating configuration table.
[0036] The inference unit is used to perform LSTM inference corresponding to the current task based on the pruned hidden state channels and the configured gating paths.
[0037] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the LSTM inference method based on channel pruning and gating configuration described in any of the first aspects above.
[0038] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the LSTM inference method based on channel pruning and gating configuration described in any of the first aspects above.
[0039] Fifthly, embodiments of this application provide a computer program product that, when run on an electronic device, causes the electronic device to execute the LSTM inference method based on channel pruning and gating configuration described in any of the first aspects above.
[0040] The proposed solution first determines the category and state complexity level of the current task based on the characteristic fluctuation range and historical state of the acquired GNSS input signal. Then, based on the category and state complexity level of the current task, the hidden state channels of the current task are pruned according to the pruning strategy selected from the task channel pruning strategy library. The gating path of the current task is configured based on the LSTM gating configuration table. Finally, the LSTM inference corresponding to the current task is executed based on the pruned hidden state channels and the configured gating path.
[0041] This application's solution does not use all hidden state channels or activate all gated paths for the current task. Instead, it prunes the hidden state channels and configures appropriate gated paths. This approach is applicable to multiple tasks, reducing redundancy in multi-task LSTM structures and demonstrating strong usability and practicality.
[0042] Other features and advantages of this application will be described in detail in the following detailed description section. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is a schematic diagram of the steps of the LSTM inference method based on channel pruning and gating configuration provided in the embodiments of this application;
[0045] Figure 2This is a schematic diagram of the GNSS multi-task LTM structure pruning system provided in the embodiments of this application;
[0046] Figure 3 This is a schematic diagram of the runtime structure configuration switching process provided in the embodiments of this application;
[0047] Figure 4 This is a schematic diagram of the structure of the LSTM inference device based on channel pruning and gating configuration provided in the embodiments of this application;
[0048] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0049] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application can also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0050] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or photovoltaic modules, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, photovoltaic modules and / or combinations thereof.
[0051] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0052] It should also be further understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0053] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [the described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [the described condition or event] is detected," or "in response to detection of [the described condition or event]."
[0054] Furthermore, in the description of this application, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0055] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in some other embodiments," "in other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0056] In GNSS chip systems, to enhance robustness and navigation awareness in complex environments, an increasing number of intelligent tasks are being integrated into the receiver. These tasks typically rely on timing modeling techniques to capture the dynamic characteristics of signals changing over time. LSTM, due to its excellent sequence modeling capabilities, has been widely used in GNSS terminals for the following typical tasks:
[0057] Satellite signal loss prediction and continuity assessment, broadband or multi-source GNSS interference trend modeling, multipath reflection feature modeling and drift estimation, satellite channel state identification and error classification, and short-time fusion path prediction for GNSS+IMU (Inertial Navigation System).
[0058] The tasks mentioned above are characterized by different task objectives, similar model structures, interleaved state dimensions, and high degree of shared computing resources. Therefore, LSTM inference models in GNSS chip systems often face the following key challenges:
[0059] (1) Redundancy problem in multi-task LSTM structure:
[0060] Traditional deployment methods design a complete LSTM structure for each task, utilizing all hidden state channels and activating all gate control paths. This "full-channel, full-path" approach leads to unnecessary resource waste, regardless of whether the current task requires full modeling capabilities. Especially in low-dynamic or periodic task phases, some hidden state output units often have outputs close to constants, contributing very little to prediction, yet still participating in the full computation.
[0061] (2) Lack of task-characteristic-driven structural adaptive mechanisms:
[0062] The existing LSTM execution structure maintains a fixed configuration during operation and cannot be adjusted according to task objectives or current state (such as disturbance mutations, stationary periods, etc.). Even if the system runs multiple tasks (such as lock loss prediction + multipath judgment + disturbance judgment), these tasks are forced to use the same LSTM structure, making it impossible to achieve on-demand resource allocation.
[0063] (3) Difficulty in reusing multi-task structures:
[0064] Although GNSS chip resources are limited, current mainstream chip designs struggle to share execution cores between LSTM models used in different tasks. This is due to fixed model structures, poor consistency in channel dimensions, incompatible states, and a lack of an effective task-structure mapping and dynamic reconstruction mechanism.
[0065] (4) Existing compression schemes lack task adaptability:
[0066] Current structural optimization techniques such as channel pruning, model sparsification, and quantization deployment are mostly performed during the training phase, making it difficult to dynamically switch structural strategies based on tasks or states during runtime. Furthermore, these compression techniques often operate on a "whole model" basis, failing to provide fine-grained control over channel-level and gating-level structural behavior.
[0067] To address the aforementioned shortcomings, this application provides an LSTM inference method based on channel pruning and gating configuration. First, the current task's category and state complexity level are determined based on the characteristic fluctuation range and historical state of the acquired GNSS input signal. Then, based on the current task's category and state complexity level, the hidden state channels of the current task are pruned using a pruning strategy selected from the task channel pruning strategy library. The gating path of the current task is configured based on the LSTM gating configuration table. Finally, the LSTM inference corresponding to the current task is executed based on the pruned hidden state channels and the configured gating path.
[0068] This application's solution does not use all hidden state channels or activate all gated paths for the current task. Instead, it prunes the hidden state channels and configures appropriate gated paths. This approach is applicable to multiple tasks, reducing redundancy in multi-task LSTM structures and demonstrating strong usability and practicality.
[0069] The specific process implemented in this application is described below through specific embodiments.
[0070] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating the steps of the LSTM inference method based on channel pruning and gating configuration provided in an embodiment of this application. Figure 1 As shown, the method includes the following steps:
[0071] S101, acquire GNSS input signal.
[0072] In one embodiment, the GNSS input signal can be either pseudorange or carrier phase. The method of this application can also be applied to other navigation systems where the input signal is a navigation signal.
[0073] S102, based on the characteristic fluctuation range and historical status of the GNSS input signal, determine the category of the current task and its state complexity level.
[0074] In one embodiment, the characteristic changes of the GNSS input signal are analyzed in real time, such as sliding window signal fluctuations, pseudorange residual abrupt changes, and interference intensity fluctuations. Based on the characteristic fluctuation range and historical state, the task state is identified, the current task category and state complexity level are determined, and the task identification code Task_ID and state complexity level code S_Level (e.g., high dynamic, low dynamic, steady state, etc.) are output.
[0075] In one embodiment, Task_ID = 0x01 represents the satellite signal loss trend prediction task, Task_ID = 0x02 represents the GNSS interference modeling and prediction task, and Task_ID = 0x03 represents the multipath reflection feature modeling and drift estimation task.
[0076] S103, based on the current task category and its state complexity level, the hidden state channel is pruned according to the pruning strategy selected from the task channel pruning strategy library, and the gating path is configured according to the LSTM gating configuration table.
[0077] In one embodiment, a pruning strategy is selected from the task channel pruning strategy library based on the category of the current task and its state complexity level. The hidden state channels of the current task are pruned based on the selected pruning strategy. A gating path configuration strategy is selected from the LSTM gating configuration table. The gating path of the current task is configured based on the selected gating path configuration strategy.
[0078] According to one embodiment of this application, the method further includes: constructing a task channel pruning strategy library based on the channel mask, the category to which each task belongs, and its state complexity level.
[0079] In one embodiment, a pruning strategy is constructed for each channel mask based on the category of each task and its state complexity level; a task channel pruning strategy library is constructed based on the pruning strategy for each channel mask.
[0080] According to one embodiment of this application, each task corresponds to a set of channel masks, each set of channel masks corresponds to an LSTM hidden state channel enable bitmap, and each channel mask is organized based on a two-dimensional table of the category to which each task belongs and its state complexity level.
[0081] In one embodiment, a set of channel masks is predefined for each task, and each set of channel masks includes multiple channel masks. Each set of masks corresponds to an LSTM hidden state channel enable bitmap, indicating which hidden state output units need to participate in the computation. The channel masks are organized into a two-dimensional table of task dimension (each dimension corresponds to a task category) × state complexity level, supporting online querying and switching.
[0082] In one embodiment, the total number of hidden state channels is 16. If the channel mask is 0b1111111000000000, the pruning strategy is: enable hidden state channels 0 to 7, prune hidden state channels 8 to 16. The enabled channels are valid, and the pruned channels are invalid.
[0083] In existing technologies, the LSTM inference model in GNSS chip systems suffers from high power consumption due to gate path redundancy. The four gate paths of LSTM (input gate, forget gate, output gate, and candidate state) are activated and computed in every inference cycle. However, in practical deployments, some tasks (such as short-term prediction tasks) have a weak dependence on the forget gate or output gate; forcing computation on these gates would waste a large number of multiply-accumulate operations, resulting in a disproportionate energy consumption and time delay during inference.
[0084] According to one embodiment of this application, the method further includes: constructing an LSTM gating configuration table based on the category and gating path of each task. Each task is bound to a set of gating path configuration strategies.
[0085] In one embodiment, the gating path includes an input gate, a forget gate, an output gate, and candidate states. The LSTM gating configuration table includes the gating path configuration strategy for each task.
[0086] According to one embodiment of this application, the gated path configuration strategy includes:
[0087] (1) Enable full door control path in standard LSTM mode;
[0088] (2) Streamlined configuration: retain (enable) some gated paths and block (disable) the rest of the gated paths. You can enable and disable freely combined gated paths;
[0089] (3) When the task status is stable, freeze some gated paths, such as skipping the output gate.
[0090] In one embodiment, gated path configuration is achieved through register-level switching via a gate enable unit.
[0091] According to one embodiment of this application, some gated paths are reserved while the remaining gated paths are blocked, including:
[0092] Retain the input gate and forget gate, and mask the output gate and candidate state; retain the input gate and output gate, and mask the forget gate and candidate state; retain the input gate and candidate state, and mask the forget gate and output gate; retain the forget gate and output gate, and mask the input gate and candidate state; retain the forget gate and candidate state, and mask the input gate and output gate; retain the output gate and candidate state, and mask the input gate and forget gate.
[0093] In this embodiment, power consumption can be reduced by properly configuring the gating path.
[0094] According to one embodiment of this application, the method further includes: updating the state according to the following calculation formula while retaining the forget gate and candidate state and masking the input gate and output gate:
[0095]
[0096] in, This indicates the current state of the cell. t Indicates time, Represents the Gate of Oblivion This represents element-wise multiplication. This indicates the cell state at the previous moment. Indicates the candidate state;
[0097]
[0098] in, This indicates the hidden state at the current moment. This represents the hyperbolic tangent function.
[0099] According to one embodiment of this application, the calculation formula for the forget gate is as follows:
[0100]
[0101] in, This represents the Sigmoid activation function. The weight matrix represents the forget gate. This indicates the hidden state at the previous moment. This represents the GNSS input signal at the current moment. Indicates to and Perform vector concatenation. Indicates the bias of the forget gate;
[0102] The formula for calculating the candidate state is as follows:
[0103]
[0104] in, The weight matrix representing the candidate states. This represents the bias of the candidate state.
[0105] In one embodiment, when all door-controlled paths are enabled, the state is updated according to the following calculation formula:
[0106]
[0107] in, Indicates the input gate;
[0108]
[0109] in, This indicates the output gate.
[0110] In one embodiment, the formula for calculating the input gate is as follows:
[0111]
[0112] in, This represents the weight matrix of the input gate. This indicates the bias of the input gate.
[0113] In one embodiment, the formula for calculating the output gate is as follows:
[0114]
[0115] in, This represents the weight matrix of the output gate. This indicates the bias of the output gate.
[0116] S104, based on the pruned hidden state channels and the configured gating path, executes the LSTM inference corresponding to the current task.
[0117] According to one embodiment of this application, the dynamic structure scheduling controller performs the following steps: Based on the current Task_ID and S_Level, it selects the corresponding channel mask from the task channel pruning policy library and the corresponding gating path configuration policy from the LSTM gating configuration table. The configuration is reloaded immediately after the current frame is processed, without needing to reconstruct the model structure. The pruning and gating configuration commands are embedded in the TFLite (TensorFlow Lite, a deep learning inference framework) delegate. The pruning and gating configuration commands are dynamically issued by the master controller or automatically scheduled by the hardware state controller.
[0118] According to one embodiment of this application, the execution path integration mechanism is as follows: the LSTM core computing structure supports "partial channel enabling" and "gated path time-sharing switching". Pruned invalid channels skip the multiply-accumulate process, and disabled gated paths do not activate the Sigmoid / Tanh function. All configuration switching is completed at frame boundaries, maintaining model state consistency.
[0119] Please see Figure 2 , Figure 2 This is a schematic diagram of the GNSS multi-task LTM structure trimming system provided in an embodiment of this application. For example... Figure 2 As shown, the system includes: an input state analysis module, a task state recognition and label generation module, a dynamic structure strategy controller (dynamic structure scheduling controller), a channel mask loading unit, a gating configuration loading controller, and an LSTM state calculation unit.
[0120] In one embodiment, the input state analysis module analyzes the input state based on the sliding window feature change rate and interference / drift index. The task state recognition and label generation module identifies the task state and outputs a task identifier (Task_ID) and a state complexity level code (S_Level).
[0121] In one embodiment, the dynamic structure strategy controller controls the pruning and gating configuration loading, specifically controlling the channel mask table lookup and the loading of the gating path selection table (LSTM gating configuration table). The channel mask loading unit loads the channel mask, and the gating configuration loading controller controls the loading of the gating path configuration.
[0122] In one embodiment, the LSTM state computation unit supports pruning, including: a MAC (Multiply-Accumulate) array (channel mask enabled) and a gated path configuration (Sigmoid / Tanh switch), and the LSTM prediction output is: the hidden state h(t) and the cell state c(t) at the current time.
[0123] In one embodiment, the overall process of the GNSS multi-task LSTM architecture pruning system includes: task state identification, policy loading, and LSTM inference path execution.
[0124] According to one embodiment of this application, the method is based on a GNSS navigation SoC (System on Chip) platform. The LSTM inference model uses shared hardware resources and supports multi-task switching and architecture configuration. The system runs the following two typical tasks:
[0125] Task A: Prediction of satellite signal loss trend (Task_ID = 0x01, sensitive to changes in historical state, requires medium accuracy); Task B: GNSS interference modeling and prediction (Task_ID = 0x02, requires long-term modeling, has a lot of state redundancy, can be highly pruned).
[0126] In one embodiment, all tasks use the same LSTM core architecture, and the hardware controls the architecture pruning through channel masks and gating configuration registers.
[0127] In one embodiment, the general LSTM structure parameters are configured as follows:
[0128] Input feature dimensions: 16 (pseudorange, carrier-to-noise ratio, FFT (Fast Fourier Transform) features), number of hidden state channels: 16, gated paths: 4 (i(t), f(t), o(t), g(t)), data format: INT8 fixed-point quantization.
[0129] In one embodiment, the structural configuration of the task A lock loss prediction task includes the following steps:
[0130] (1) Task status recognition: The current trajectory is detected to be stable, S_Level = "LOW"; the task ID is identified as Task ID = 0x01;
[0131] (2) Look up the strategy table (task channel pruning strategy library and LSTM gating configuration table): Channel mask = 0b1111111000000000 (enable hidden state channels 0~7); Gating path configuration: enable i(t), f(t), g(t), and disable o(t);
[0132] (3) Configuration loading: The dynamic structure scheduling controller writes the channel mask and gate path configuration into the configuration register; the LSTM inference logic enables the first 8 hidden state channels; the output gate path is not executed, o(t) = 1.0 (default value).
[0133] Performance evaluation: power consumption decreased by approximately 34%; RMSE (Root Mean Square Error) change was less than 0.8%; the state remained continuous, demonstrating good adaptability.
[0134] In one embodiment, the channel pruning method and execution logic (implemented using channel masks) for task A are as follows:
[0135] (1) Input: Task_ID = 0x01 (Lockout prediction task), S_Level = LOW (State stable);
[0136] (2) Strategy table lookup: Channel mask = 0b1111111000000000;
[0137] (3) Execution path: Only the first 4 hidden state output units participate in the calculation. For i in [0,3]: → MAC[i] starts, activates input → intermediate state → output merge; the remaining units are skipped or set to 0.
[0138] It should be noted that the channel mask is updated once per frame, the channel clipping granularity is a single hidden unit, and all disabled paths are skipped during multiplication, addition, and state writing.
[0139] In one embodiment, the structural configuration of Task B: GNSS interference modeling task includes the following steps:
[0140] (1) Task status identification: The current interference fluctuation is slow, S_Level = “MID”; the task ID is identified as Task_ID = 0x02, the current status of Task B is frozen, and it is marked as “recoverable”;
[0141] (2) Strategy table lookup: Channel mask = 0b1110000000000000 (enable hidden state channels 0~3); Gated path configuration: enable only f(t) and g(t), disable i(t) and o(t);
[0142] (3) Execution process: Hidden state channels 0-3 are enabled, and the remaining hidden state channels are skipped; only the forget gate and candidate paths (candidate states) are calculated, ignoring the input gate and output gate; the final state update is simplified to:
[0143]
[0144]
[0145] Performance evaluation: power consumption decreased by approximately 48%; model accuracy decreased by no more than 1.5%; the interference trend modeling results were stable, and the predicted output changes smoothly.
[0146] In one embodiment, for task B, when interference is detected, the dynamic enable / disable configuration mechanism for the gating path is as follows:
[0147] (1) Input: Task_ID = 0x02 (interference modeling task), S_Level = MID (signal jitter);
[0148] (2) Gating path configuration: Enabled gating path = {f gate, g gate}, Disabled gating path = {i gate, o gate};
[0149] (3) LSTM execution:
[0150] Only the following formulas are activated:
[0151]
[0152]
[0153] The following paths are skipped: i(t), o(t), and the entire path is set to 0 or a constant value (e.g., 1.0).
[0154] It should be noted that in this embodiment, the state update is controlled by f(t) and g(t), and the inference power consumption is reduced by about 30%.
[0155] Please see Figure 3 , Figure 3 This is a schematic diagram of the runtime structure configuration switching process provided in an embodiment of this application. For example... Figure 3 As shown, the runtime structure configuration switching process (task switching + configuration distribution) is as follows:
[0156] (1) After the inference in the previous frame is completed, detect the input change and perform state analysis;
[0157] (2) Identify the task ID and state complexity level;
[0158] (3) Look up the table: Find the channel mask and gating path configuration in the policy table;
[0159] (4) Send the found channel mask and gating path configuration to the configuration register;
[0160] (5) Load the channel mask and gating path configuration into the LSTM execution path;
[0161] (6) The next frame is reasoned according to the new structure.
[0162] In one embodiment, dynamic frame boundary switching is supported, configuration prefetching and caching are supported, the switching time is about 1 to 2 clock cycles, and the configuration data can be completed under the control of the master controller or FSM (Finite State Machine).
[0163] In one embodiment, during actual deployment: each time the task scheduler issues a task ID; the dynamic structure scheduling controller, based on the state analysis results, looks up the corresponding channel mask and gating path configuration from the policy table; the channel mask is configured to the enable bit of the MAC array; the gating path configuration is loaded into the active path control module; all configurations are switched at the LSTM inference frame boundary without interruption. The switching delay is only 1-2 clock cycles, which has no impact on navigation timing accuracy.
[0164] According to one embodiment of this application, the overall resource saving effect is statistically shown in Table 1:
[0165] Table 1
[0166]
[0167] According to one embodiment of this application, the chip deployment is recommended as follows:
[0168] Mask table / gating table: can be implemented as a small ROM (Read-Only Memory) or register array; Dynamic loading logic: recommended to be integrated into the LSTM control state machine (FSM); Policy scheduling interface: supports TFLiteDelegate instruction issuance or master control driver configuration command writing.
[0169] The LSTM inference method based on channel pruning and gating configuration provided in this application first determines the category and state complexity level of the current task based on the characteristic fluctuation range and historical state of the acquired GNSS input signal. Then, based on the category and state complexity level of the current task, the hidden state channels of the current task are pruned according to the pruning strategy selected from the task channel pruning strategy library. The gating path of the current task is configured based on the LSTM gating configuration table. Finally, the LSTM inference corresponding to the current task is executed based on the pruned hidden state channels and the configured gating path.
[0170] This application's solution does not use all hidden state channels or activate all gated paths for the current task. Instead, it prunes the hidden state channels and configures appropriate gated paths. This approach is applicable to multiple tasks, reducing redundancy in multi-task LSTM structures and demonstrating strong usability and practicality.
[0171] This application provides an LSTM structure optimization method that can dynamically trim channels and configure gating paths according to task category and state changes, achieving navigation inference with "lightweight and adjustable structure + controllable accuracy loss + intelligent task response".
[0172] This application's solution combines a task state recognition mechanism to dynamically select the number of hidden state output unit channels and the enabled gating path structure during inference, achieving on-demand pruning and differentiated configuration. Based on the task type (e.g., lockout prediction, interference modeling, multi-path judgment) and the degree of state change (e.g., stable, abrupt, highly dynamic), the optimal LSTM structure is dynamically matched, significantly reducing computational resources and power consumption while maintaining prediction accuracy and response speed.
[0173] Compared with the prior art, the solution of this application has the following significant technical advantages:
[0174] (1) Fine-grained channel pruning, on-demand execution: Pruning strategy matching is performed through the "task × state" dimension, so that only the necessary hidden state output units are activated in each frame, which greatly reduces computational complexity and MAC overhead;
[0175] (2) Multi-task structure adaptation: Each task has an independent structure strategy library, which can adjust the required computing intensity and energy consumption target respectively, support the coexistence of heterogeneous configurations between tasks, and adapt to the needs of multi-task parallel operation.
[0176] (3) Supports dynamic switching during runtime: structural pruning and gating configuration can be dynamically switched according to the input state during inference, supporting event-driven, adaptive scheduling and precision-energy consumption trade-off optimization;
[0177] (4) Chip deployment friendly: The pruning mechanism only affects path scheduling and register enable control. The logic structure can be integrated into the existing LSTM core or TFLite actuator, which is easy to implement on SoC;
[0178] (5) Compatible with quantization and sparse optimization: It can be used in parallel with INT8 / INT4 quantization inference, sparse matrix execution and other technologies to further compress running resources and adapt to the deployment requirements of lightweight navigation chips (28~32nm);
[0179] (6) High accuracy retention rate: Under the premise of reasonable configuration of the task channel pruning strategy library, when the channel pruning rate reaches more than 50%, the model accuracy decreases by no more than 2%, which meets the tolerance of GNSS navigation tasks.
[0180] It should be understood that the sequence number of each step in the above embodiments does 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 this application.
[0181] Corresponding to the method in the above embodiments, Figure 4 This is a schematic diagram of the LSTM inference device based on channel pruning and gating configuration provided in an embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown.
[0182] Please see Figure 4 The device includes:
[0183] Acquisition unit 401 is used to acquire GNSS input signals;
[0184] The determination unit 402 is used to determine the category and state complexity level of the current task based on the characteristic fluctuation range and historical state of the GNSS input signal.
[0185] The processing unit 403 is used to prune the hidden state channel according to the category to which the current task belongs and its state complexity level, based on the pruning strategy selected from the task channel pruning strategy library, and to configure the gating path based on the LSTM gating configuration table.
[0186] The inference unit 404 is used to perform LSTM inference corresponding to the current task based on the pruned hidden state channels and the configured gating path.
[0187] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0188] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments 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. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0189] Figure 5 This is a schematic diagram of the structure of the electronic device 5 provided in an embodiment of this application. Figure 5 As shown, the electronic device 5 of this embodiment includes: at least one processor 501 ( Figure 5 Only one is shown in the diagram), memory 503, and computer program 502 stored in memory 503 and executable on at least one processor 501, wherein processor 501 executes computer program 502 to implement the steps in the above method embodiments.
[0190] Electronic device 5 can be a desktop computer, laptop, handheld computer, or mobile phone, etc. This electronic device 5 may include, but is not limited to, a processor 501 and a memory 503. Those skilled in the art will understand that... Figure 5 This is merely an example of electronic device 5 and does not constitute a limitation on electronic device 5. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, it may also include input / output devices, network access devices, etc.
[0191] The processor 501 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware photovoltaic modules, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0192] In some embodiments, memory 503 may be an internal storage unit of electronic device 5, such as a hard disk or memory of electronic device 5. In other embodiments, memory 503 may be an external storage device of electronic device 5, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on electronic device 5. Furthermore, memory 503 may include both internal and external storage units of electronic device 5. Memory 503 is used to store operating system, application programs, boot loader, data, and other programs, such as program code of computer programs. Memory 503 may also be used to temporarily store data that has been output or will be output.
[0193] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, when implementing all or part of the processes in the methods of the above embodiments, this application can use a computer program to instruct related hardware. This computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps applied in the method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include at least: any entity or device capable of carrying computer program code to a computing device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, such as a USB flash drive, a portable hard drive, a magnetic disk, or an optical disk.
[0194] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the various method embodiments described above.
[0195] This application provides a computer program product that, when run on an electronic device, causes the electronic device to execute the steps described in the various method embodiments above.
[0196] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0197] 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.
[0198] In the embodiments provided in this application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. The device / electronic device embodiments described above are merely illustrative, and the division of modules or units described above is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple units or photovoltaic modules may be combined or integrated into another system, and some features may be ignored. Furthermore, the indirect coupling, direct coupling, or communication connection shown or discussed between them can be through some interfaces, devices, or units, and can be electrical, mechanical, or other forms.
[0199] The units described above 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 network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0200] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the above embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. An LSTM inference method based on channel pruning and gating configuration, characterized in that, The method includes: Acquire GNSS input signal; Based on the characteristic fluctuation range and historical status of the GNSS input signal, determine the category and state complexity level of the current task; Based on the current task category and its state complexity level, the hidden state channel is pruned according to the pruning strategy selected from the task channel pruning strategy library, and the gating path is configured according to the LSTM gating configuration table. Based on the pruned hidden state channels and the configured gating paths, perform LSTM inference corresponding to the current task; Specifically, based on the current task category and its state complexity level, hidden state channels are pruned using pruning strategies selected from the task channel pruning strategy library. Gating paths are configured based on the LSTM gating configuration table, including: Based on the current task's category and its state complexity level, a target pruning strategy is determined in the task channel pruning strategy library. The hidden state channels of the current task are pruned based on the target pruning strategy. A target gating path configuration strategy is determined in the LSTM gating configuration table. The gating path of the current task is configured based on the target gating path configuration strategy. The method further includes: constructing the task channel pruning strategy library based on the channel mask, the category to which each task belongs, and its state complexity level; constructing the LSTM gating configuration table based on the category to which each task belongs and the gating path; wherein, each task is bound to a set of gating path configuration strategies.
2. The LSTM inference method based on channel pruning and gating configuration according to claim 1, characterized in that, Each task corresponds to a set of channel masks, and each set of channel masks corresponds to an LSTM hidden state channel enable bitmap. Each channel mask is organized based on a two-dimensional table of the category to which each task belongs and its state complexity level.
3. The LSTM inference method based on channel pruning and gating configuration according to claim 1, characterized in that, Gated path configuration strategies include: Enable all gated paths; retain some gated paths and disable the rest; freeze some gated paths when the task status is stable.
4. The LSTM inference method based on channel pruning and gating configuration according to claim 3, characterized in that, The gating path includes: input gate, forget gate, output gate, and candidate states; some gating paths are retained, while the rest are disabled, including: Retain the input gate and forget gate, and mask the output gate and candidate state; retain the input gate and output gate, and mask the forget gate and candidate state; retain the input gate and candidate state, and mask the forget gate and output gate; retain the forget gate and output gate, and mask the input gate and candidate state; retain the forget gate and candidate state, and mask the input gate and output gate; retain the output gate and candidate state, and mask the input gate and forget gate.
5. The LSTM inference method based on channel pruning and gating configuration according to claim 4, characterized in that, The method further includes: With the forget gate and candidate states preserved, and the input and output gates masked, the state is updated according to the following calculation formula: in, This indicates the current state of the cell. t Indicates time, Represents the Gate of Oblivion This represents element-wise multiplication. This indicates the cell state at the previous moment. Indicates the candidate state; in, This indicates the hidden state at the current moment. This represents the hyperbolic tangent function.
6. The LSTM inference method based on channel pruning and gating configuration according to claim 5, characterized in that, The formula for calculating the forgetting gate is as follows: in, This represents the Sigmoid activation function. The weight matrix represents the forget gate. This indicates the hidden state at the previous moment. This represents the GNSS input signal at the current moment. Indicates to and Perform vector concatenation. Indicates the bias of the forget gate; The formula for calculating the candidate state is as follows: in, The weight matrix representing the candidate states. This represents the bias of the candidate state.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the LSTM inference method based on channel pruning and gating configuration as described in any one of claims 1-6.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the LSTM inference method based on channel pruning and gating configuration as described in any one of claims 1-6.
Citation Information
Patent Citations
Network model pruning method and device, electronic equipment and storage medium
CN115496199A
Network model compression method and device, electronic equipment and storage medium
CN115526307A
Output channel control method and device of convolution model and storage medium
CN120745731A