Training method for spiking neural networks, spiking neural networks and devices

CN122366537APending Publication Date: 2026-07-10PEKING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610267360.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-06
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing spiking neural networks suffer from a conflict between sparsity and accuracy loss during training. Gradient propagation is prone to gradient vanishing and convergence is difficult, resulting in excessive energy consumption and computational complexity.

Method used

Through multiple iterations of training, the weight parameters are updated by combining the task loss function, and the discharge threshold parameters are dynamically adjusted based on the historical discharge frequency of the neuron model to simulate the adaptive behavior of biological neurons, control the activation probability of neurons, and achieve sparse discharge.

Benefits of technology

It effectively reduces the energy consumption of spiking neural networks, maintains model accuracy, avoids gradient vanishing, promotes model gradient propagation and convergence, and improves model sparsity and energy efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122366537A_ABST
    Figure CN122366537A_ABST
Patent Text Reader

Abstract

This application provides a training method, a spiking neural network, and an apparatus for a spiking neural network. The method includes: iteratively training the spiking neural network using training data of the object to be processed, wherein the spiking neural network contains at least one neuron model; calculating a task loss function based on the training results of the spiking neural network and updating the weight parameters; updating the current discharge threshold parameter of the neuron model based on the historical discharge frequency of the neuron model, wherein the value of the current discharge threshold parameter increases with the increase of the historical discharge frequency; and obtaining the trained spiking neural network model using the updated weight parameters and the updated discharge threshold parameter after multiple iterations of training. This method facilitates the training of a sparsely discharging spiking neural network, reduces the energy consumption during spiking neural network applications, and improves model energy efficiency by using the trained spiking neural network model to process the data of the object to be processed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a training method, a spiking neural network, and an apparatus. Background Technology

[0002] With the widespread application of deep neural networks in fields such as computer vision and natural language processing, the scale and complexity of models are constantly increasing, leading to a sharp rise in energy consumption during the training and inference phases. Spiking Neural Networks (SNNs) transmit information in an event-driven manner, generating computation only when neurons fire pulses. Theoretically, they have a high energy efficiency ratio and are considered ideal models for neuromorphic computing and neuromorphic hardware.

[0003] In spiking neural networks, sparsity means that at any given time, only a small number of neurons are active (i.e., firing spikes). This is similar to how biological nervous systems work, which reduces the number of neurons that need to be processed, thereby reducing the computational load and energy consumption of the model. Therefore, high-energy-efficiency spiking neural networks are needed in applications such as computer vision and natural language processing. Summary of the Invention

[0004] This application provides a training method, a spiking neural network, and an apparatus for a spiking neural network, in order to alleviate or solve one or more technical problems existing in the prior art.

[0005] In a first aspect, embodiments of this application provide a training method for a spiking neural network, comprising: performing multiple iterative training on a pre-constructed spiking neural network using training data of a target object, wherein the spiking neural network includes at least one neuron model; in any iteration of training, calculating a task loss function based on the training results of the training data output by the spiking neural network, and updating the weight parameters of the spiking neural network using the task loss function; updating the current firing threshold parameter of the neuron model based on the historical firing frequency of the neuron model, wherein the historical firing frequency is used to characterize the frequency with which the neuron model fires pulse signals within a predetermined time window, and the value of the current firing threshold parameter increases with the increase of the historical firing frequency; obtaining a trained spiking neural network model using the updated weight parameters and the updated firing threshold parameter after the multiple iterations of training, and processing the target object's data using the trained spiking neural network model to obtain the processing result of the target data.

[0006] Secondly, embodiments of this application provide a spiking neural network, including: an input layer, intermediate layers, and an output layer, wherein at least one intermediate layer is followed by a neuron model; the intermediate layer includes at least one of: a convolutional layer, a fully connected layer, an attention layer, or a residual network structure; the spiking neural network is a network model trained according to the training method of the spiking neural network of the first aspect described above.

[0007] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor implements any of the methods of embodiments of this application when executing the computer program.

[0008] According to the method of this application embodiment, during the iterative training of a spiking neural network using training data of the object to be processed, the weight parameters are updated according to the task loss function of the spiking neural network, and the current firing threshold parameters of the neuron models included in the spiking neural network are updated according to the historical firing frequency of the neuron models. Thus, using the updated weight parameters and updated firing threshold parameters after multiple iterations of training, a trained spiking neural network model is obtained. This trained spiking neural network model is then used to process the data of the object to be processed, obtaining the processing result of the data. In this method, updating the weight parameters of the spiking neural network according to the task loss function helps maintain the accuracy of the trained spiking neural network model. Adjusting the firing threshold parameters based on the historical firing frequency of the neuron model is an adaptive and dynamic threshold adjustment mechanism. As the spiking neural network receives new training data and training tasks during training, the firing threshold parameters of the neuron models are continuously adjusted and optimized. This mechanism simulates the adaptive behavior of biological neurons, making the behavior of artificial neural networks closer to that of biological nervous systems. By dynamically adjusting the firing threshold parameters of the neuron models, the current firing threshold parameter value increases with the increase of the historical firing frequency, which can control the activation probability of neurons, thereby facilitating the training of sparsely firing spiking neural networks and reducing the energy consumption of spiking neural network applications. Furthermore, this method helps maintain the activation probability of the neuron model within a reasonable range, thus helping to avoid the problem of gradients becoming too small or vanishing during propagation, promoting the propagation of model gradients in the network, and making spiking neural networks more likely to converge. According to this method, during model training, combining updating synaptic weights based on the task loss function and updating the current firing threshold based on historical firing frequencies helps improve the sparsity of the model and increase its energy efficiency.

[0009] In this method, the trained spiking neural network model is used to process the data to be processed. Since the neuron firing threshold has been optimized based on historical firing frequency during the training stage, it helps to reduce the energy consumption of the spiking neural network during application and inference. The weight parameters optimized by the task loss function help to maintain the data feature extraction capability of the relevant processing tasks in the application and inference stages, thereby improving the model's energy efficiency.

[0010] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application, it can be implemented according to the contents of the specification. In order to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description

[0011] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the various drawings denote the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings depict only some embodiments according to this application and should not be construed as limiting the scope of this application.

[0012] Figure 1 A flowchart illustrating a training method for a spiking neural network according to an embodiment of this application is shown; Figure 2 A flowchart illustrating the neuron model simulating the firing behavior of neurons according to an embodiment of this application is shown. Figure 3a This document illustrates a model structure diagram of a spiking neural network according to an embodiment of this application. Figure 3b A model structure diagram of a spiking neural network according to another embodiment of this application is shown; Figure 4 A schematic flowchart illustrating a model training method for a spiking neural network according to an exemplary embodiment of this application is shown. Figure 5 This diagram illustrates the structure of a training apparatus for a spiking neural network according to an embodiment of this application. Figure 6 A block diagram of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0013] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the concept or scope of this application. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.

[0014] To facilitate understanding of the technical solutions of the embodiments of this application, the relevant technologies of the embodiments of this application are described below. The following relevant technologies are optional solutions and can be combined with the technical solutions of the embodiments of this application in any way, and all of them fall within the protection scope of the embodiments of this application.

[0015] Traditional artificial neural networks require intensive computation on all neurons during execution. Even neurons that contribute little to the final output are frequently activated, resulting in significant redundant computation and energy waste. In contrast, spiking neural networks, through sparse pulse coding, can achieve efficient inference with lower power consumption and possess bio-inspired temporal dynamics.

[0016] Current spiking neural networks still face many challenges during training, including: regularization methods that directly constrain neuron firing rates are prone to causing conflicts in optimization objectives, resulting in a loss of accuracy while pursuing sparsity; as spiking activity becomes sparsified, gradient vanishing is likely to occur during gradient propagation, making it difficult for the network to converge; and existing activity regularization methods limit the practical deployment of high-energy-efficiency spiking neural networks.

[0017] It should be noted that the application scenarios or examples provided in the embodiments of this application are for ease of understanding, and the embodiments of this application do not specifically limit the application of the technical solutions. In addition, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0018] The technical solution of this application and how it solves the aforementioned technical problems are described in detail below with specific embodiments. The listed specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0019] Figure 1 A flowchart illustrating the training method of a spiking neural network according to an embodiment of this application is shown, as follows: Figure 1 As shown, the method may include steps S101 to S104.

[0020] Step S101: Using the training data of the object to be processed, perform multiple iterations of training on the pre-constructed spiking neural network, wherein the spiking neural network contains at least one neuron model.

[0021] Step S102: In any iteration of training, calculate the task loss function based on the training results of the training data output by the spiking neural network, and use the task loss function to update the weight parameters of the spiking neural network.

[0022] Step S103: Update the current firing threshold parameter of the neuron model based on the historical firing frequency of the neuron model. The historical firing frequency is used to characterize the frequency with which the neuron model fires pulse signals within a predetermined time window. The value of the current firing threshold parameter increases with the increase of the historical firing frequency.

[0023] Step S104: Using the updated weight parameters and updated discharge threshold parameters after multiple iterations of training, a trained spiking neural network model is obtained. The trained spiking neural network model is then used to process the data to be processed, and the processing result of the data is obtained.

[0024] During the iterative training of the spiking neural network, the weight parameters are updated according to the task loss function of the spiking neural network, and the current firing threshold parameters of the neuron models are updated according to the historical firing frequency of the neuron models contained in the spiking neural network. Thus, the trained spiking neural network model is obtained by using the updated weight parameters and updated firing threshold parameters after multiple iterations of training. The trained spiking neural network model is then used to process the data to be processed, and the processing result of the data is obtained.

[0025] In this training method, updating the weight parameters of the spiking neural network (SNN) based on the task loss function helps maintain the accuracy of the trained SNN model. Adjusting the discharge threshold parameter based on the historical discharge frequency of the neuron model is an adaptive and dynamic threshold adjustment mechanism. As the SNN receives new training data and tasks during training, the discharge threshold parameter of the neuron model is continuously adjusted and optimized. This mechanism simulates the adaptive behavior of biological neurons, making the behavior of the artificial neural network closer to that of a biological nervous system. By dynamically adjusting the discharge threshold parameter of the neuron model, the current value of the discharge threshold parameter increases with the historical discharge frequency, which controls the activation probability of neurons. This is beneficial for training a sparsely discharging SNN, reducing the energy consumption of SNN applications. Furthermore, this method helps maintain the activation probability of the neuron model within a reasonable range, thus helping to avoid the problem of gradients becoming too small or vanishing during propagation, promoting the propagation of model gradients in the network, and making the SNN converge more easily. According to this method, combining updating weights based on the task loss function and updating the current discharge threshold based on historical discharge frequency during model training is beneficial for improving model sparsity and energy efficiency.

[0026] In this method, the trained spiking neural network model is used to process the data to be processed. Since the neuron firing threshold has been optimized based on historical firing frequency during the training stage, it helps to reduce the energy consumption of the spiking neural network during application and inference. The weight parameters optimized by the task loss function help to maintain the data feature extraction capability of the relevant processing tasks in the application and inference stages, thereby improving the model's energy efficiency.

[0027] In steps S102 and S103 above, updating the weight parameters of the spiking neural network using the task loss function is called weight update. Updating the current firing threshold parameter of the neuron model based on its historical firing frequency is called threshold update. In any given training iteration, weight update and threshold update are performed alternately.

[0028] As an example, in a spiking neural network, synaptic weights can be understood as the strength of the connection between neurons. A larger weight indicates a greater influence of one neuron on another. Conversely, a smaller weight indicates a smaller influence of one neuron on another.

[0029] Alternating updates refer to updating the discharge threshold parameter and the current discharge threshold parameter separately in each training iteration; that is, the two parameters are not updated simultaneously. For example, the weight parameter is updated first, followed by the current discharge threshold parameter. Or, the current discharge threshold parameter is updated first, followed by the weight parameter. In practical scenarios, the specific order of updating these two parameters is not strictly limited.

[0030] In this embodiment, weight updates aim to minimize task loss, while threshold updates aim to control the firing frequency of neurons. This parameter update strategy helps improve performance while maintaining network sparsity and is suitable for training spiking neural networks.

[0031] In step S101, the neuron model is an abstraction and simulation of the behavior of biological neurons, used to simulate the information processing function of neurons in artificial neural networks. For ease of understanding, the following will illustrate this further. Figure 2 Describe how the neuron model works. Figure 2 A flowchart illustrating the neuron model simulating the firing behavior of neurons according to an embodiment of this application is shown.

[0032] exist Figure 2 In this context, the input to a neuron includes "t" "Membrane potential at time t-1" and "input current at time t" are used to define the membrane potential at time t-1 and the external input current received by the neuron at time t.

[0033] "Pre-emission membrane potential" indicates: [The text abruptly ends here, likely due to an incomplete translation or a missing section.] The membrane potential before discharge is calculated using the membrane potential at time 1 and the input current at time t.

[0034] "Comparison threshold" means: compare the pre-discharge membrane potential with the current discharge threshold parameter value.

[0035] "Threshold pulse firing at time t" means that the neuron fires a pulse signal when the membrane potential exceeds the threshold (the threshold is the value of the current firing threshold parameter) based on the comparison result.

[0036] "Threshold adaptation" means that the current firing threshold parameter is updated based on the neuron's historical firing frequency, and the current firing threshold parameter is adaptively adjusted. For example, if the neuron fires too frequently, the threshold may be increased to reduce the firing frequency.

[0037] "Membrane potential at time t" means: the membrane potential at time t is updated based on whether a pulse is fired. Specifically, if a pulse is fired, the membrane potential can be reset to zero; if no pulse is fired, the membrane potential can continue to accumulate.

[0038] This flowchart describes the dynamic behavior of neurons at each time step, including membrane potential updates, threshold comparisons, and spike firing. This dynamic behavior mimics the workings of biological neurons, giving spiking neural networks an advantage in processing time-series data and achieving brain-like computing.

[0039] In some embodiments, the neuron model includes the following three main modules: a membrane potential accumulation module, a threshold adjustment module, and a pulse firing and resetting module.

[0040] The membrane potential accumulation module is used to receive input signals from the front layer neurons. And based on the leakage coefficient The membrane potential is updated by integration. The membrane potential at the current time step t can be expressed as the following expression (1): (1) In the above expression (1), This represents the membrane potential after reset in the previous time step. The input signal received by the neuron model. Leakage coefficient, This represents the neuron membrane potential at the current time step (or at the current time t).

[0041] The threshold adjustment module is used to adjust the value of the current firing threshold parameter (hereinafter referred to as the threshold) according to the historical firing frequency of the neuron. When the neuron fires frequently, the threshold increases accordingly to suppress subsequent pulse activity. The adaptive update of the threshold can be expressed in the recursive form shown in the following expression (2): (2) In the above expression (2), For the threshold increment, This represents the current firing threshold parameter, i.e., the value of the current firing threshold parameter. The threshold increment is related to the number of times the neuron fires and its activity level.

[0042] In this embodiment, the firing threshold parameter is used to define the minimum membrane potential value at which the neuron simulates firing a pulse. The neuron fires a pulse signal only if the neuron's membrane potential at the current time step t (or the current moment t) exceeds the value of the current firing threshold parameter.

[0043] Pulse delivery and reset module: When the membrane potential Exceeding the current threshold At this time, the neuron outputs a current-type pulse signal and immediately resets the membrane potential to the resting value (less than or equal to the predetermined membrane potential threshold) or zero, that is, resets it to a lower value. The output pulse signal can be defined as follows (3): (3) In the above expression (3), where This represents the heaviside step function. The current threshold, This represents the neuron membrane potential at the current time step (or time t). The pulse signal at the current time step (or time t). It can be seen that when the neuron's membrane potential is greater than the current threshold ( When ), the step function The value is 1. That is, the amplitude of the pulse output signal is equal to the current firing threshold parameter. When the neuron membrane potential is less than or equal to the current threshold ( When ), the step function The value is 0. That is, no pulse output signal is output. It can be seen that the threshold can be understood as the trigger point for neuron firing, simulated by the neuron model. The neuron will fire only when its membrane potential exceeds this threshold. The range of the pulse output signal is {0,} This can maintain the binary characteristics of the pulse output and enhance numerical stability.

[0044] The membrane potential reset can be expressed as the following expression (4): (4) The definitions of the symbols in the above expression (4) are the same as those of the same symbols in the above expressions (1)-(3), and will not be repeated here. It can be seen from expression (4) that when the step function... When the value is 1, the membrane potential resets to zero after the neuron fires. When the step function... When the value is 0, the neuron does not fire, and the membrane potential remains unchanged.

[0045] In this embodiment, the threshold adjustment mechanism of the neuron model enables neurons to achieve self-inhibitory activation during training, avoiding gradient vanishing or optimization conflict problems caused by global regularization methods, thereby maintaining the stability of network learning.

[0046] In this embodiment, the object to be processed refers to an entity or content that needs to be processed and analyzed. The type of the object to be processed may specifically include at least one of the following time-series data: image data, video data, audio data, text data, or at least one of other modalities of time-series data. Other modalities of time-series data include, for example, real-time sensing data generated by edge devices. Edge devices include, but are not limited to, at least one of the following: intelligent monitoring or security equipment, industrial IoT, autonomous driving equipment, wearable devices, and smart homes. Real-time sensing data includes, but is not limited to, at least one of the following: environmental monitoring data (for anomaly detection and / or prediction of environmental change trends), time-series data from inertial measurement units (for motion recognition and / or attitude estimation), and vibration sensor data (for fault prediction). The training data for the object to be processed is the encoded object converted into a time-series pulse signal that can be processed by a spiking neural network. In the training method of the spiking neural network, the output result of the spiking neural network is the corresponding processing result of the spiking neural network on the training data.

[0047] In spiking neural networks, the input data, such as the training data of the object to be processed during model training or the processing data of the object to be processed during model application, is a time-series pulse signal obtained by pulse encoding of the object to be processed. For example, the input data can be converted into a series of pulses by a pulse encoder, and the temporal distribution and frequency of these pulses encode the information of the original data. The pulse output signal can be understood as the result of the spiking neural network's response to the input data.

[0048] In the training process of a spiking neural network, a time step is a discretized unit of time, while a moment in time is a point in continuous time. In a spiking neural network, continuous time is divided into a series of equally spaced time steps. Each time step can represent a moment in time.

[0049] In step S102, the weight parameters can be updated by minimizing the task loss function. The loss function can be used to estimate the gap between the model training result and the model training objective.

[0050] As an example, weight parameters include synaptic weight parameters. As another example, weight parameters may also include any of the following: convolutional kernel parameters, inter-layer connection weights, and attention weights. Different network architectures may use different weight parameters, which affect the behavior and performance of spiking neurons and the network, and can be adjusted during training using the backpropagation algorithm.

[0051] As an example, the update rule for the weight parameters can be expressed as the following expression (5): (5) In the above expression (5), This indicates the amount of time the weight parameters have been updated. Indicates the learning rate. This represents the gradient of the task loss function with respect to the weight parameters. The weight parameters can be determined using gradient descent, i.e., by minimizing the task loss function. The updated weight parameters minimize the difference between the output of the spiking neural network and the output of the network.

[0052] As examples, gradient descent algorithms can include backpropagation algorithms based on gradient descent, Adam optimization algorithms, etc.

[0053] In this embodiment, the gradient itself is a vector, which can be called a gradient vector. The gradient vector can indicate the direction of updating the weight parameters in the training process of the spiking neural network. Along the direction of the gradient vector, the model parameters are updated according to the magnitude of the gradient vector to ensure that the result of each training of the spiking neural network is closer to the training target.

[0054] In step S103 above, if the historical discharge frequency is determined to be increasing, the current discharge threshold parameter needs to be adjusted upwards. An increase in the historical discharge frequency can be determined in at least one of the following ways: For example, if the historical discharge frequency obtained in the current iteration is greater than or equal to the historical discharge frequency obtained in the previous iteration, then the historical discharge frequency is determined to be increasing. Another example is if the historical discharge frequency obtained in the current iteration is greater than or equal to a predetermined frequency threshold, then the historical discharge frequency is determined to be increasing. Yet another example is pre-dividing the historical discharge frequency into multiple value intervals, where "multiple" means at least two. If the historical discharge frequency obtained in the current iteration is in the first discharge frequency interval, and the historical discharge frequency obtained in the previous iteration is in the second discharge frequency interval, and the discharge frequency value in the first interval is greater than the discharge frequency value in the second interval, then the historical discharge frequency is determined to be increasing. Yet another example is if, in multiple consecutive (at least two) iterations of training, the historical discharge frequency obtained in each iteration is greater than or equal to the historical discharge frequency obtained in the previous iteration, then the historical discharge frequency is determined to be increasing.

[0055] In some embodiments, step S103 may specifically include: counting the number of times the neuron model fires pulse signals within a predetermined time window; and increasing the current firing threshold parameter when the number of pulse signals fires increases.

[0056] As an example, a predetermined time window is a specific time period used in a spiking neural network to simulate the behavior of neurons. Multiple time windows can be processed as needed during a single training iteration. For instance, when processing sequence data, the entire input sequence can be traversed using a sliding time window.

[0057] As an example, in a spiking neural network, the number of times a neuron model fires a pulse signal within a predetermined time window is counted as the historical firing frequency of that neuron model. Historical firing frequency is an important indicator characterizing how frequently a neuron fires pulse signals within a specific time window.

[0058] As an example, "increased number of times" means that the number of times counted in the current training iteration is higher than the number of times counted in the previous training iteration. The current firing threshold parameter is dynamically adjusted based on the historical firing frequency of the neuron model, so that the firing threshold parameter increases with the increase of the number of firing times.

[0059] As an example, if the number of pulse signals emitted does not increase (i.e., the number of times in this count is less than or equal to the number of times in the previous count), the discharge threshold parameter can be reduced or its value can be kept unchanged.

[0060] As an example, an increase in the number of pulse signals can be determined by at least one of the following methods. For instance, if the number of pulse signals emitted within a predetermined time window is greater than or equal to a preset threshold.

[0061] As an example, an increase in the number of pulses can also be determined in other ways. For instance, if the number of pulse signals emitted within a predetermined time window is greater than or equal to a preset threshold, it can be considered an increase in the number of pulses. For example, multiple (at least two) pulse emission ranges can be preset. If the number of pulses obtained in the current training iteration is in the first range, and the number obtained in the previous training iteration is in the second range, and the value in the first range is greater than the value in the second range, then it is considered an increase in the number of pulses. Another example is that in multiple (at least two) consecutive training iterations, if the number of pulse signals emitted by the neuron model within a predetermined time window in each iteration is greater than or equal to the number obtained in the previous iteration, it is considered an increase in the number of pulses. If the number of pulse signals emitted by the neuron model within a predetermined time window is increasing based on statistics, then the current firing threshold parameter needs to be adjusted upwards.

[0062] In this embodiment, as the number of pulse signals increases, adjusting the current firing threshold parameter reduces the number of times the neuron model is activated, preventing frequent activation and thus enhancing the network's sparsity. This effectively reduces unnecessary computation and energy consumption, lowers network energy consumption and computational complexity, and improves network energy efficiency. Combined with updating the weight parameters of the spiking neural network through a loss function, this helps avoid the probability of gradient vanishing during gradient propagation as pulse activity becomes sparsified, leading to network convergence difficulties and further improving model energy efficiency.

[0063] In some embodiments, in step S104, the trained spiking neural network is used to perform predetermined processing on the data to be processed of the object to be processed, so as to obtain the processing result of the data to be processed.

[0064] As an example, if the spiking neural network is a classification model, then the intended processing type is classification processing, and the processing result can be the classification result of the object to be processed. If the spiking neural network is an object recognition model, then the intended processing is object recognition processing, and the processing result can be the object recognition result of the object to be processed. For ease of understanding, classification results focus on category attribution, such as animal, plant, person, etc. Object recognition results focus on individual differentiation, such as the identity of the object to be processed, such as who it is, which category it belongs to, etc.

[0065] In some embodiments, adjusting the current discharge threshold parameter includes: for multiple time steps within a predetermined time window, using an alternative gradient relationship to calculate a quantified value of the influence of the current discharge threshold parameter on the pulse output signal at each time step; the alternative gradient makes the proximity of the membrane potential of the neuron model to the current discharge threshold parameter proportional to the probability of the neuron model firing a pulse signal; determining a cumulative value of influence based on the quantified value of influence corresponding to each time step; and generating an adjustment amount for the current discharge threshold parameter based on the cumulative value of influence.

[0066] As an example, the alternative gradient relationship is configured such that if the absolute difference between the membrane potential and the current discharge threshold parameter is less than the current discharge threshold parameter, a non-zero gradient value based on the absolute difference is output; if the absolute difference is greater than or equal to the current discharge threshold parameter, zero is output.

[0067] As a concrete example, this alternative gradient relationship is represented by the following expression (6): (6) In the above expression (6), max represents taking the maximum value. The definitions of other symbols are the same as those of the same symbols in the above expressions (1)-(3), and will not be repeated here. As can be seen from the step function in the above embodiment, the step function is used to determine whether the current membrane potential of the neuron model exceeds the threshold, thereby deciding whether to fire a pulse. However, the step function cannot be differentiated. Gradient descent requires calculating the derivative of the loss function with respect to the model parameters. This derivative is used to measure the direction in which the loss function value changes the fastest under the current model parameters. When optimizing the model based on the gradient descent method, the model parameters can be updated along the opposite direction of the gradient, so that the loss function value decreases the fastest, thereby gradually approaching the optimal solution. This brings difficulties to the training method based on gradient descent.

[0068] Therefore, to calculate and optimize gradients during training, the neuron model employs an alternative gradient to approximate the derivative of the impulse firing function. This method allows gradient propagation during training, enabling differentiable training and improving training stability and efficiency. Furthermore, despite the use of an alternative gradient, the neuron output remains sparse, preserving the sparsity of neuronal activity.

[0069] It should be understood that alternative gradient relationships include, but are not limited to, the functional relationships shown in expression (6) above. For example, they can also be the Sigmoid function, the Gaussian function, or other derivative functions that approximate the gradient, as long as they satisfy the condition that gradient propagation can be performed during training for the entire impulse firing process.

[0070] For example, the quantized value of the influence of the current discharge threshold parameter on the pulse output signal at each time step is calculated using an alternative gradient relation; that is, the value of the expression of the alternative gradient relation is directly used as the quantized value of the influence. The quantized value of the influence is used to quantify the degree to which the pulse output signal is affected by the current discharge threshold parameter.

[0071] From the above expression (6), it can be seen that regardless of whether m[t]>θ or m[t]<θ, if the membrane potential is closer to the current discharge threshold parameter, the absolute value of the difference between the two is closer to 0, and the value of max is closer to 1. That is, the derivative of the pulse output signal with respect to the threshold is closer to 1, that is, the threshold has a greater influence on the pulse output signal.

[0072] Specifically, when m[t] > θ, the closer m[t] is to θ, the more significant the increase in the threshold will be in the probability of the neuron firing a pulse, because the increase in the threshold makes it more difficult for the membrane potential to exceed the threshold. When m[t] < θ, the closer m[t] is to θ, the more easily the membrane potential will exceed the threshold by decreasing the threshold. Therefore, if the absolute difference between the membrane potential and the current firing threshold parameter is less than the current firing threshold parameter, it means that the membrane potential is close to the current firing threshold parameter. At this time, a non-zero gradient value based on the absolute difference is output as the quantification value of the degree of influence corresponding to the current time step (time t).

[0073] For example, the cumulative value of the impact is obtained by summing the quantitative values ​​of the impact at each time step.

[0074] In this embodiment, the cumulative value of the influence level is correlated with the historical firing frequency of the neuron model. For example, the larger the cumulative value of the influence level, the more frequent the firing frequency, and thus the higher the historical firing frequency. Based on this cumulative value, an update amount can be generated that causes the firing threshold parameter to be adjusted upwards.

[0075] In this embodiment, the influence of the threshold at each time step on the pulse firing probability is utilized instead of gradient quantization. These influences are accumulated to determine the amount of threshold adjustment. The threshold increment is calculated based on the number of pulses fired by the neuron, and the firing threshold parameter is dynamically adjusted. This is beneficial for improving the sparsity of the spiking neural network and enhancing its energy efficiency.

[0076] In some embodiments, determining the cumulative value of influence based on the quantized value of influence corresponding to each time step includes: for any time step, calculating the ratio of the pulse output signal of the time step to the current discharge threshold parameter; multiplying the ratio corresponding to the time step by the quantized value of influence corresponding to the time step as the quantized value of influence of the current discharge threshold parameter on the pulse output signal of the time step; and summing the quantized values ​​of influence for each time step to obtain the cumulative value of influence.

[0077] As an example, the ratio of the pulse output signal at a time step to the current firing threshold parameter can be expressed as s[t] / θ. This ratio can be understood as the alternative gradient of the pulse output signal with respect to the current firing threshold parameter, used to represent how threshold changes affect the firing behavior of neurons.

[0078] Since the amplitude of the pulse signal is equal to the current firing threshold parameter, if the neuron model fires a pulse signal, the ratio of the two is 1. The neuron fires a pulse signal with an amplitude equal to the threshold, and the quantized value of the influence is accumulated. If the neuron model does not fire a pulse signal, the ratio of the two is 0. No pulse signal is fired in this time step, so there is no need to accumulate the quantized value of the influence.

[0079] In this embodiment, by calculating the ratio of the pulse output signal to the discharge threshold and combining it with the quantized value of the degree of influence, it is beneficial to accurately assess the impact of the discharge threshold on the pulse output at each time step. By accumulating these quantized values, a cumulative value of the degree of influence is obtained, which can be used to dynamically adjust the discharge threshold, optimize network sparsity, and improve energy efficiency.

[0080] In some embodiments, generating an upward adjustment of the current discharge threshold parameter based on the cumulative value of the impact includes: adjusting the cumulative value of the impact based on a preset threshold regularization coefficient to obtain an adjusted value of the cumulative value of the impact; calculating the gradient of the task loss function with respect to the current discharge threshold parameter; and generating an upward adjustment of the current discharge threshold parameter based on the gradient and the adjusted value of the cumulative value of the impact.

[0081] As an example, the amount of upward adjustment of the current discharge threshold parameter can be expressed as the following expression (7): (7) In the above expression (7), This is the gradient of the task loss function with respect to the weight parameters. This indicates the degree to which the threshold affects whether a neuron fires a pulse signal. The ratio of [t] to θ is 1 when a pulse signal is emitted, and 0 when no pulse signal is emitted. This represents the cumulative value of the impact. This is the threshold regularization coefficient, used to weight the cumulative value of the influence. Let T be the learning rate. T is the total number of time steps.

[0082] In this embodiment, the threshold parameter is updated based on the activity regularization term. With task gradient The weight parameters are jointly determined, and are updated only based on the task loss. This helps to avoid the gradient vanishing problem caused by direct impulse regularization, and improves training convergence and model sparsity.

[0083] By combining the threshold regularization coefficient to adjust the cumulative value of the influence degree and using the gradient of the task loss function, the upward adjustment amount of the discharge threshold parameter is dynamically generated. Increasing the value of the current discharge threshold parameter by increasing the upward adjustment amount is beneficial to improving the sparsity of the network, and can also enhance the model's energy efficiency and convergence ability, thus improving the model's energy efficiency.

[0084] In some embodiments, the upward adjustment of the current discharge threshold parameter is generated based on the cumulative value of the impact level. Other implementation methods may also be included. For example, the cumulative value can be directly converted into an upward adjustment amount using a fixed proportional coefficient. Another example is that a data table can be predefined or trained to map the cumulative impact level to the corresponding upward adjustment amount, and the data table can record the cumulative impact level and the corresponding upward adjustment amount. In practical scenarios, the specific implementation form can be selected according to actual needs.

[0085] In some embodiments, calculating the ratio of the pulse output signal at a time step to the current discharge threshold parameter includes: setting the ratio to one if the neuron model fires a pulse signal at a time step and the amplitude of the pulse signal is equal to the current discharge threshold parameter; and setting the ratio to zero if the neuron model does not fire a pulse signal at a time step.

[0086] As an example, the pulse signal emitted by a neuron model, also known as the pulse output signal, is the signal generated when a pulse is emitted, and is usually represented as a spike or pulse at a time step. The amplitude of the pulse can be defined in different ways; it can be equal to the firing threshold, or it can be equal to a fixed value (such as 1), or it can be defined differently depending on the model.

[0087] In this embodiment, the amplitude of the pulse output signal is set as the parameter value of the current firing threshold parameter. When a neuron fires a pulse, the ratio is set to 1, indicating that firing significantly contributes to performance; when no pulse is fired, the ratio is 0, indicating no contribution. This method can effectively distinguish the different effects of neuronal activity on network output, providing a basis for accumulating the quantification value of the degree of influence and for subsequent dynamic adjustment of the firing threshold.

[0088] In some embodiments, before calculating the task loss function based on the training results of the training data output by the spiking neural network, the method further includes: determining the membrane potential at the current time step based on the membrane potential of the neuron model after reset at the previous time step and the input signal at the current time step; and outputting a pulse signal through the neuron model and setting the membrane potential after reset at the current time step to zero based on the fact that the membrane potential at the current time step is greater than the current discharge threshold parameter, wherein the amplitude of the pulse signal is equal to the current discharge threshold parameter.

[0089] As an example, the membrane potential at the current time step can be calculated using the above expression (1), the amplitude of the output pulse signal can be represented by the above expression (3), and the membrane potential after reset can be represented by the above expression (4). Further details will not be provided here.

[0090] In this embodiment, discrete time steps are used to simulate the dynamics of neurons. Within each time step, the neuronal membrane potential is calculated based on the input current, a firing pulse is calculated based on the membrane potential, and the membrane potential is updated based on the firing pulse. All firing pulses in each time step are statistically analyzed, and the threshold is updated based on the firing intensity. By calculating the membrane potential at the current time step and firing a pulse signal when the membrane potential exceeds the threshold, the behavior of biological neurons is effectively simulated. This helps ensure that the amplitude of the pulse signal is consistent with the firing threshold, enhancing the network's dynamic response capability.

[0091] In some embodiments, the training method of the spiking neural network further includes: pruning the weight parameters of the spiking neural network during multiple iterations of training. The pruning process includes: removing or setting the target weight parameter to zero after at least one iteration of training, wherein the absolute value of the target weight parameter is less than a preset pruning threshold.

[0092] As an example, pruning is a model sparsity technique that reduces model complexity by removing connections with smaller absolute weights from the network. Weight pruning assumes that these small weights have little impact on the network's decision-making process; removing them reduces the number of parameters and computational cost without significantly affecting model performance.

[0093] In this embodiment, weight pruning can reduce the model's storage requirements and computational load, thereby improving the model's running efficiency. By combining weight pruning and activity sparsity strategies, weights with smaller absolute values ​​are gradually removed during training, achieving simultaneous weight sparsity and activity sparsity, significantly reducing the number of operations and energy consumption.

[0094] According to the training method of this application, neurons are simulated based on time-step discretization during training to accurately reproduce the dynamic evolution of neuronal membrane potential and threshold. When a neuron continuously fires impulses, the threshold increases with the number of firings, thereby achieving dynamic inhibition of impulse activity. All threshold parameters are fixed during the inference phase, and the threshold changes are integrated into the network weights. This can be understood as absorbing the threshold into the weights of subsequent layers, thereby reducing computational load without changing the model's functionality and ensuring the model's compatibility and energy efficiency on neuromorphic hardware. This method can accurately simulate the firing behavior of neurons while ensuring computational stability and efficiency, and is suitable for implementation on central processing units (CPUs), field-programmable gate arrays (FPGAs), and dedicated neuromorphic chips.

[0095] Figure 3a This diagram illustrates the structure of a spiking neural network model according to an embodiment of this application. Figure 3bA structural diagram of a spiking neural network model according to another embodiment of this application is shown. Figure 3a The spiking neural network shown includes: an image input layer 301, a convolutional layer 302, a threshold-adaptive neuron layer 303, a fully connected layer 305, and an output layer 306.

[0096] Figure 3b The illustrated spiking neural network includes: an image input layer 301, a linear attention layer 307, a threshold adaptive neuron layer 303, a fully connected layer 305, and an output layer 306. Figure 3b The spiking neural network shown is Figure 3a In the illustrated spiking neural network, identical or equivalent modules have the same label.

[0097] exist Figure 3a and Figure 3b In the image input layer 301 and the output layer 306, there are intermediate layers and a threshold adaptive neuron layer 303. Figure 3a The intermediate layers in the illustrated spiking neural network include two convolutional layers 302 and one fully connected layer 305. Each convolutional layer 302 is followed by a threshold-adaptive neuron layer 303. Figure 3b The intermediate layers in the illustrated spiking neural network include two linear attention layers 307 and one fully connected layer 305. Each linear attention layer 307 is followed by a threshold-adaptive neuron layer 303.

[0098] As an example, the threshold-adaptive neuron layer 303 can be implemented as the neuron model described in the above embodiments. During the training of the spiking neural network, the current firing threshold parameter can be updated based on the historical firing frequency of the neuron model. See the description in the above embodiments for details, which will not be repeated here.

[0099] It should be understood that, Figure 3a and Figure 3b In this embodiment, N convolutional layers 302 may be included, depending on actual needs. N1 convolutional layers 302 are followed by threshold-adaptive neuron layers 303, where N is an integer greater than or equal to 1, and N1 is an integer greater than or equal to 1 and less than or equal to N. Alternatively, a threshold-adaptive neuron layer 303 may be connected after a fully connected layer 305, depending on actual needs. The specific configuration can be adjusted according to actual requirements, and this embodiment does not impose specific limitations.

[0100] In some embodiments of this application, the spiking neural network includes: an input layer, intermediate layers, and an output layer, with at least one intermediate layer followed by a neuron model; the intermediate layer includes at least one of: a convolutional layer, a fully connected layer, an attention layer, or a residual network structure; the spiking neural network is a network model trained according to any of the spiking neural network training methods described in the above embodiments.

[0101] As an example, after constructing a multi-layered spiking neural network containing a neuron model, the spiking neural network is iteratively trained using the training method of the model described in the above embodiment. During the training process, the weight parameters and discharge threshold parameters are updated alternately, which significantly reduces the average discharge rate and energy consumption while ensuring model performance.

[0102] In this embodiment, a multilayer spiking neural network containing neurons with threshold constraints is obtained; during training, synaptic weight parameters and threshold parameters are alternately optimized; weight parameters, such as synaptic weights, are updated by minimizing the task loss function, and threshold parameters are adaptively adjusted by historical firing frequencies; threshold constraints are used instead of direct pulse regularization to reduce the conflict between sparsity and performance objectives; and backpropagation algorithm can be combined to achieve cross-layer gradient transfer and end-to-end training to obtain the trained spiking neural network model.

[0103] This application's embodiments introduce a neuron model with threshold constraints, achieving self-regulation of neuron activity and energy consumption control without altering the binary characteristics of the spikes. A discretized threshold update mechanism and an alternative gradient approximation function ensure the differentiability and stability of the training process. Threshold constraints based on historical firing frequencies help alleviate the optimization conflict between sparsity constraints and task objectives, improving model convergence efficiency. This allows for a significant reduction in average firing rate and number of operations while maintaining model accuracy, achieving a high-energy-efficiency and highly sparsity spiking neural network. The method of this application's embodiments is widely applicable to various spiking neural network model structures and neuromorphic hardware platforms, providing fundamental support for low-power intelligent computing.

[0104] Figure 4 A flowchart illustrating the model training method of an exemplary embodiment of this application is shown. Figure 4 Modules that are the same as or equivalent to those in Figure 3 have the same labels. Figure 4 In this model, the image input layer 301 receives image data as training data. The convolutional layer 302 or attention linear layer 307 extracts image features through convolution operations (corresponding to the convolutional layer) or attention mechanisms (corresponding to the attention linear layer). In some scenarios, the attention linear layer 307 may also include linear transformations to further process these image features.

[0105] The threshold-adaptive neuron layer 303 contains a neuron model whose firing threshold parameter can be adaptively adjusted based on historical firing frequencies to optimize network performance. The specific implementation can be found in the description of the above embodiment, and will not be repeated here. The fully connected layer 305 maps the extracted features to the output layer 306, which integrates information and prepares for the final decision. The output layer 306 generates the output result. For example, if the spiking neural network is an image classification model, the output result is the classification result of the image data. If the spiking neural network is an object recognition model, the output result is the object recognition result. Figure 4 In this context, the global gradient represents the gradient of the loss function with respect to the weight parameters at each training phase (in an iterative training phase), which guides the updating of the weight parameters.

[0106] Throughout the training process, the spiking neural network iteratively optimizes its parameters, including weight parameters and firing threshold parameters. The spiking neural network incorporates a threshold-constrained neuron model, which introduces a dynamic threshold adjustment mechanism based on traditional leaky integral firing neurons. During training, it dynamically learns and adjusts the dynamic firing threshold parameter, adaptively updating and adjusting it based on the neuron's historical firing frequency. This allows the neuron to maintain the binary characteristics of the pulse while adaptively adjusting the threshold according to its own firing history, thereby controlling the pulse firing frequency and improving model sparsity and energy efficiency. Specifically, the firing threshold parameter of the neuron model can increase with the increase of historical firing frequency to reduce the number of pulse firings, achieving dynamic suppression of firing activity, realizing self-inhibition regulation and stable pulse signal output, effectively reducing firing activity and improving model stability. The neuron output uses current-type binary 0 and θ. Through discrete simulation of the neuron, the membrane potential and threshold are updated at fixed time steps. Differentiable training of the pulse firing process is achieved through gradient approximation, and the threshold is absorbed into the weights of subsequent layers during the inference phase to improve the compatibility with neuromorphic hardware.

[0107] Through the model training method of this application, in practical applications, spiking neural networks can achieve classification accuracy of over 90% on multiple benchmark datasets, while reducing the average firing rate to less than 10% of the original model, significantly reducing energy consumption and making the model more suitable for deployment on low-power devices. This application, by proposing a neuron model with threshold constraints, a discrete simulation method, and a sparse training algorithm based on this model, can significantly reduce spiking activity and energy consumption while ensuring performance, providing a feasible and unified solution for high-energy-efficiency neuromorphic computing.

[0108] In this embodiment, the spiking neural network includes a neuron model. The firing threshold parameter of the neuron model can be adaptively adjusted according to historical firing frequencies. During each model iteration training process, synaptic weights and threshold parameters are alternately optimized. Combining task loss and sparsity constraint objectives, the neuron firing rate and synaptic operand number are significantly reduced while maintaining model accuracy. In the inference phase, a fixed-threshold model can be used to achieve efficient event-driven computation on neuromorphic hardware, thereby improving energy efficiency. The solution in this embodiment can be widely applied to low-power intelligent computing devices, possessing high sparsity, stability, and scalability, and is suitable for fields such as image recognition, speech processing, and edge intelligence.

[0109] Corresponding to the application scenarios and methods provided in the embodiments of this application, the embodiments of this application also provide a training device for a spiking neural network.

[0110] Figure 5 This diagram illustrates a structural schematic of a training apparatus for a spiking neural network according to an embodiment of this application. This apparatus is used to execute the training method provided in any of the above embodiments, such as... Figure 5 As shown, the device includes the following modules.

[0111] The training module 510 is used to perform multiple iterations of training on a pre-built spiking neural network using the training data of the object to be processed. The spiking neural network contains at least one neuron model.

[0112] The first update module 520 is used to calculate the task loss function based on the training results of the training data output by the spiking neural network in any iteration of training, so as to update the weight parameters of the spiking neural network using the task loss function.

[0113] The second update module 530 is used to update the current firing threshold parameter of the neuron model based on the historical firing frequency of the neuron model. The historical firing frequency is used to characterize the frequency with which the neuron model fires pulse signals within a predetermined time window. The value of the current firing threshold parameter increases with the increase of the historical firing frequency.

[0114] The determination module 540 is used to obtain the trained spiking neural network model by utilizing the updated weight parameters and updated discharge threshold parameters after multiple iterations of training.

[0115] In some embodiments, the second updating module 530, when updating the current firing threshold parameter of the neuron model based on the historical firing frequency of the neuron model, is specifically used to: count the number of times the neuron model fires a pulse signal within a predetermined time window; and increase the current firing threshold parameter when the number of pulse signals fires increases.

[0116] In some embodiments, the second updating module 530, when used to adjust the current discharge threshold parameter, specifically performs the following: for multiple time steps within a predetermined time window, it uses an alternative gradient relationship to calculate a quantified value of the degree of influence of the current discharge threshold parameter on the pulse output signal of each time step; the alternative gradient makes the degree of proximity between the membrane potential of the neuron model and the current discharge threshold parameter proportional to the probability of the neuron model firing a pulse signal; based on the quantified value of the degree of influence corresponding to each time step, it determines a cumulative value of the degree of influence; based on the cumulative value of the degree of influence, it generates an adjustment amount for the current discharge threshold parameter.

[0117] In some embodiments, the second updating module 530, when determining the cumulative value of influence based on the quantized value of influence corresponding to each time step, specifically performs the following: for any time step, calculate the ratio of the pulse output signal of the time step to the current discharge threshold parameter; multiply the ratio corresponding to the time step by the quantized value of influence corresponding to the time step as the quantized value of influence of the current discharge threshold parameter on the pulse output signal of the time step; sum the quantized values ​​of influence for each time step to obtain the cumulative value of influence.

[0118] In some embodiments, the second update module 530, when used to generate an upward adjustment amount for the current discharge threshold parameter based on the cumulative value of the influence degree, is specifically used to: adjust the cumulative value of the influence degree based on a preset threshold regularization coefficient to obtain an adjusted value of the cumulative value of the influence degree; calculate the gradient of the task loss function with respect to the current discharge threshold parameter; and generate an upward adjustment amount for the current discharge threshold parameter based on the gradient and the adjusted value of the cumulative value of the influence degree.

[0119] In some embodiments, the second updating module 530, when calculating the ratio of the pulse output signal at a time step to the current discharge threshold parameter, specifically performs the following: if the neuron model emits a pulse signal at a time step and the amplitude of the pulse signal is equal to the current discharge threshold parameter, the ratio is set to one; if the neuron model does not emit a pulse signal at a time step, the ratio is set to zero.

[0120] In some embodiments, the apparatus further includes: a discrete simulation module, configured to determine the membrane potential at the current time step based on the membrane potential of the neuron model after reset at the previous time step and the input signal at the current time step before calculating the task loss function based on the training results of the training data output by the spiking neural network; and based on the fact that the membrane potential at the current time step is greater than the current discharge threshold parameter, output a pulse signal through the neuron model and set the membrane potential after reset at the current time step to zero, wherein the amplitude of the pulse signal is equal to the current discharge threshold parameter.

[0121] In some embodiments, the apparatus further includes a pruning module for pruning the weight parameters of the spiking neural network during multiple iterations of training. The pruning process includes removing or setting the target weight parameter to zero after at least one iteration of training, wherein the absolute value of the target weight parameter is less than a preset pruning threshold.

[0122] The functions of each module in each device in the embodiments of this application can be found in the corresponding description in the above method, and they have corresponding beneficial effects, which will not be repeated here.

[0123] In this embodiment, a training algorithm for a sparse spiking neural network is used. The spiking neural network includes a neuron model with threshold constraints. The neuron model updates the membrane potential and threshold using a fixed time step through a discrete simulation method. Differentiable training of the pulse firing process is achieved by replacing the gradient approximation. This helps to solve technical problems such as gradient vanishing, optimization instability, high energy consumption, and the conflict between sparsity and performance in the sparse training of spiking neural networks. Thus, while ensuring the accuracy of the model, the neuron pulse firing rate and computational complexity are reduced, and the energy efficiency and scalability of the spiking neural network are improved.

[0124] This application also provides a data processing method, including: acquiring an object to be processed; performing pulse encoding on the object to be processed to obtain a timing pulse signal of the object to be processed; inputting the timing pulse signal of the object to be processed into a trained spiking neural network, so as to perform predetermined processing on the data to be processed of the object to be processed through the trained spiking neural network to obtain the processing result of the data to be processed.

[0125] In some embodiments, the trained spiking neural network is a network trained according to any of the spiking neural network training methods described in the above embodiments. As an example, if the type of the spiking neural network is a classification model, then the predetermined processing is classification processing, and the processing result can be the classification result of the object to be processed. If the type of the spiking neural network is an object recognition model, then the predetermined processing is object recognition processing, and the processing result can be the object recognition result of the object to be processed. For ease of understanding, the classification result focuses on category attribution, such as animal, plant, person, etc. The object recognition result is individual differentiation, such as the identity of the object to be processed, such as who it is, which one it is, etc.

[0126] It should be noted that the type of object to be processed and the training process of the spiking neural network can be found in the detailed description of the above embodiments, and will not be repeated here.

[0127] Figure 6 This is a block diagram of an electronic device used to implement embodiments of this application. For example... Figure 6As shown, the electronic device includes a memory 601 and a processor 602. The memory 601 stores a computer program that can run on the processor 602. When the processor 602 executes the computer program, it implements the method described in the above embodiments. The number of memories 601 and processors 602 can be one or more. In a specific implementation, the electronic device may also include a communication interface 603 for communicating with external devices and exchanging data.

[0128] In practical implementation, if the memory 601, processor 602, and communication interface 603 are implemented independently, they can be interconnected via a bus to communicate with each other. This bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0129] Optionally, in a specific implementation, if the memory 601, processor 602 and communication interface 603 are integrated on a single chip, the memory 601, processor 602 and communication interface 603 can communicate with each other through an internal interface.

[0130] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method provided in this application.

[0131] This application provides a computer program product, including a computer program that, when executed by a processor, implements the method provided in this application.

[0132] This application also provides a chip, which includes a processor for calling and executing instructions stored in a memory, causing a communication device with the chip installed to perform the method provided in this application.

[0133] This application also provides a chip, including: an input interface, an output interface, a processor, and a memory. The input interface, output interface, processor, and memory are connected through an internal connection path. The processor is used to execute code in the memory. When the code is executed, the processor is used to execute the method provided in the application embodiment.

[0134] It should be understood that the aforementioned processor can be a central processing unit (CPU), or 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 components, etc. General-purpose processors can be microprocessors or any conventional processor. It is worth noting that the processor can be a processor supporting Advanced Reduced Instruction Set Machines (ARM) architecture.

[0135] Further, optionally, the aforementioned memory may include read-only memory and random access memory. The memory may be volatile memory or non-volatile memory, or may include both. Non-volatile memory may include read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available. Examples include Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Sync Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).

[0136] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another.

[0137] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.

[0138] Furthermore, the terms "first" and "second" 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" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

[0139] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process. Furthermore, the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functionality involved.

[0140] The logic and / or steps described in the flowchart or otherwise herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).

[0141] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. All or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware, the program being stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiments.

[0142] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. This storage medium can be a read-only memory, a disk, or an optical disk, etc.

[0143] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope described in this application, and these should all 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.

Claims

1. A training method for a spiking neural network, characterized in that, The method includes: Using the training data of the object to be processed, a pre-constructed spiking neural network is trained iteratively multiple times, wherein the spiking neural network contains at least one neuron model; In any iteration of training, a task loss function is calculated based on the training results of the training data output by the spiking neural network, and the weight parameters of the spiking neural network are updated using the task loss function. The current firing threshold parameter of the neuron model is updated based on the historical firing frequency of the neuron model. The historical firing frequency is used to characterize the frequency with which the neuron model fires pulse signals within a predetermined time window. The value of the current firing threshold parameter increases with the increase of the historical firing frequency. By using the updated weight parameters and updated discharge threshold parameters after multiple iterations of training, a trained spiking neural network model is obtained. This model is then used to process the data to be processed, resulting in a processing outcome for the data.

2. The method according to claim 1, characterized in that, The step of updating the current firing threshold parameter of the neuron model based on the historical firing frequency of the neuron model includes: The number of times the neuron model fires a pulse signal within a predetermined time window is counted. As the number of times the pulse signal is emitted increases, the current discharge threshold parameter is increased.

3. The method according to claim 2, characterized in that, The adjustment of the current discharge threshold parameter includes: For multiple time steps within the predetermined time window, the influence of the current firing threshold parameter on the pulse output signal at each time step is quantified using an alternative gradient relationship; the alternative gradient makes the degree of closeness between the membrane potential of the neuron model and the current firing threshold parameter proportional to the probability of the neuron model firing a pulse signal. Based on the quantified value of the impact degree corresponding to each time step, the cumulative value of the impact degree is determined; Based on the cumulative value of the impact level, the upward adjustment amount of the current discharge threshold parameter is generated.

4. The method according to claim 3, characterized in that, The determination of the cumulative impact value based on the quantified impact value corresponding to each time step includes: For any time step, calculate the ratio of the pulse output signal at that time step to the current discharge threshold parameter; The product of the ratio corresponding to the time step and the quantized value of the influence degree corresponding to the time step is used as the quantized value of the influence degree of the current discharge threshold parameter on the pulse output signal of the time step. The cumulative value of the influence degree is obtained by summing the quantitative values ​​of the influence degree at each time step.

5. The method according to claim 3, characterized in that, The step of generating the upward adjustment amount of the current discharge threshold parameter based on the cumulative value of the influence level includes: The cumulative value of the influence degree is adjusted based on a preset threshold regularization coefficient to obtain the adjusted value of the cumulative value of the influence degree; Calculate the gradient of the task loss function with respect to the current discharge threshold parameter; Based on the adjustment value of the gradient and the cumulative value of the influence, the upward adjustment amount of the current discharge threshold parameter is generated.

6. The method according to claim 4, characterized in that, The calculation of the ratio of the pulse output signal at the time step to the current discharge threshold parameter includes: Based on the neuron model, a pulse signal is emitted at the time step, and the amplitude of the pulse signal is equal to the current discharge threshold parameter, and the ratio is set to one. Since the neuron model did not fire a pulse signal at the time step, the ratio is set to zero.

7. The method according to claim 1, characterized in that, Before calculating the task loss function based on the training results of the training data output by the spiking neural network, the method further includes: The membrane potential at the current time step is determined based on the membrane potential of the neuron model after reset at the previous time step and the input signal at the current time step. Based on the fact that the membrane potential at the current time step is greater than the current discharge threshold parameter, a pulse signal is output through the neuron model and the membrane potential after the reset at the current time step is set to zero. The amplitude of the pulse signal is equal to the current discharge threshold parameter.

8. The method according to claim 1, characterized in that, The method further includes: During the multiple iterations of training, the weight parameters of the spiking neural network are pruned. The pruning process includes removing or setting the target weight parameter to zero after at least one iteration of training, wherein the absolute value of the target weight parameter is less than a preset pruning threshold.

9. A spiking neural network, characterized in that, The spiking neural network includes: An input layer, intermediate layers, and an output layer, with at least one intermediate layer followed by a neuron model; the intermediate layer includes at least one of the following: a convolutional layer, a fully connected layer, an attention layer, or a residual network structure. The spiking neural network is a network model trained according to any one of the spiking neural network training methods in claims 1-8.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory, wherein the processor, when executing the computer program, implements the method of any one of claims 1 to 8.