Automatic mixed precision quantization method and device

Through deep reinforcement learning algorithm training agents, the quantized bit width of intermediate variables in the MIMO detector is automatically allocated, which solves the problem of quantized bit width redundancy in hardware-friendly detectors, and achieves the saving of hardware resources and the improvement of performance efficiency.

CN114897098BActive Publication Date: 2025-04-25PURPLE MOUNTAIN LAB
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210634034.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-06
Publication Date
2025-04-25
Estimated Expiration
2042-06-06

AI Technical Summary

Technical Problem

The existing hardware-friendly MIMO detectors adopt a unified quantization solution, resulting in redundancy in the quantization bit width, resulting in waste of hardware resources.

Method used

The agent is trained through a deep reinforcement learning algorithm, and the quantized bit width of different intermediate variables in the MIMO detector is automatically allocated based on the trained strategy, so as to quantize the decimal width and integer bit width.

Benefits of technology

Avoid quantized bit width redundancy, save hardware resources, and improve the performance efficiency of MIMO detectors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114897098B_ABST
    Figure CN114897098B_ABST
Patent Text Reader

Abstract

The present invention provides an automatic mixed precision quantization method and device, wherein the method comprises: obtaining intermediate variables to be quantized generated by a multi-input multi-output MIMO detector in the process of detecting signals in a MIMO system; training an intelligent agent through a deep reinforcement learning algorithm, and quantizing the decimal bit width of each intermediate variable based on the strategy stored in the trained intelligent agent; and quantizing the integer bit width of each intermediate variable based on a probability density function. The present invention can automatically realize the allocation of quantization bit widths of different intermediate variables in a MIMO detector, avoid a large amount of quantization bit width redundancy, and save hardware resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine learning, and in particular to an automatic mixed precision quantization method and device. Background Art

[0002] As the demand for throughput and stability of communication systems continues to increase, multiple-input multiple-output (MIMO) systems have attracted widespread attention due to their potential for high spectral efficiency. Since the computational complexity of the optimal detection algorithm in large-scale MIMO scenarios is unaffordable in hardware implementation, many hardware-friendly detectors have been implemented and show obvious advantages in throughput, energy efficiency, and area efficiency. However, existing hardware-friendly detectors mainly focus on arithmetic implementation rather than quantization optimization, and in order to save design workload, most of them adopt a unified quantization scheme with the same quantization bit width for all variables, resulting in a large amount of quantization bit width redundancy and a waste of hardware resources. Summary of the invention

[0003] The present invention provides an automatic mixed precision quantization method and device, which are used to solve the defect that a MIMO detector in the prior art uses the same quantization scheme for all variables, resulting in a large amount of quantization bit width redundancy and a waste of hardware resources. The method and device can automatically realize the allocation of quantization bit widths of different intermediate variables in the MIMO detector, avoid a large amount of quantization bit width redundancy, and save hardware resources.

[0004] The present invention provides an automatic mixed precision quantization method, comprising:

[0005] Acquire an intermediate variable to be quantized generated by the MIMO detector in the process of performing signal detection on the MIMO system;

[0006] The intelligent agent is trained by a deep reinforcement learning algorithm, and the decimal width of each intermediate variable is quantized based on the strategy stored in the trained intelligent agent;

[0007] The integer bit width of each of the intermediate variables is quantized.

[0008] According to an automatic mixed precision quantization method provided by the present invention, the training of an intelligent agent by a deep reinforcement learning algorithm comprises:

[0009] In each round, the environment is initialized, the agent interacts with the environment based on the Markov decision process, and the interaction data is stored;

[0010] Every time a preset number of rounds is reached, the agent is controlled to update the strategy stored in the agent based on the currently stored interaction data until a maximum number of rounds is reached.

[0011] According to an automatic mixed precision quantization method provided by the present invention, the initialization environment includes:

[0012] Randomly extract multiple intermediate variables;

[0013] Initialize the decimal width of all intermediate variables to the preset maximum decimal width, and initialize the integer width of all intermediate variables to the preset maximum integer width;

[0014] Determine a plurality of states, wherein the plurality of states include sequence numbers and decimal place widths corresponding to the plurality of intermediate variables;

[0015] A state is randomly selected from the plurality of states and returned.

[0016] According to an automatic mixed precision quantization method provided by the present invention, the intelligent agent interacts with the environment based on the Markov decision process and stores the interaction data, including:

[0017] Perform the following steps at each moment until the current moment reaches the maximum moment, and store the interaction data generated at each moment, the interaction data including state, action value and reward value:

[0018] Determine an action value according to the current state and the current strategy; wherein the action value is used to characterize the change in the decimal place width;

[0019] Modify the current quantization scheme according to the action value to obtain a modified quantization scheme;

[0020] The modified quantization scheme is evaluated according to the reward function to obtain a reward value, and the next state is selected and returned.

[0021] According to an automatic mixed precision quantization method provided by the present invention, the decimal width of each intermediate variable is quantized based on the strategy stored in the trained agent, including:

[0022] Converting the strategies stored in the trained intelligent agent into a statistical distribution of decimal places of each intermediate variable through a Monte Carlo simulation algorithm;

[0023] quantizing the decimal place width of the intermediate variable based on the statistical distribution of the decimal place width of the intermediate variable;

[0024] The strategy is used to characterize the mapping relationship between the state and the action value, the state includes the sequence number and decimal place width corresponding to the intermediate variable, and the action value is used to characterize the change in the decimal place width.

[0025] According to an automatic mixed precision quantization method provided by the present invention, the strategy stored in the trained agent is converted into a statistical distribution of the decimal place width of each intermediate variable by a Monte Carlo simulation algorithm, comprising:

[0026] The following steps are performed in each test until the maximum number of tests is reached, and the frequency of each intermediate variable taking different decimal place widths is obtained, thereby obtaining the statistical distribution of the decimal place width of each intermediate variable:

[0027] For each of the intermediate variables, determining an action value based on the current state of the intermediate variable and the strategy stored in the trained agent;

[0028] The decimal width of the intermediate variable is changed based on the action value.

[0029] According to an automatic mixed precision quantization method provided by the present invention, the decimal place width of the intermediate variable is quantized based on the statistical distribution of the decimal place width of the intermediate variable, including:

[0030] Based on the statistical distribution of the decimal place widths of the intermediate variables, a mean value of the statistical distribution of the decimal place widths of the intermediate variables is determined as the decimal place widths of the intermediate variables.

[0031] According to an automatic mixed precision quantization method provided by the present invention, quantizing the integer bit width of each intermediate variable includes:

[0032] Generate a plurality of data of each intermediate variable by a Monte Carlo simulation algorithm to obtain a first data set;

[0033] Extracting data in the first data set that are not within the quantization scheme amplitude range to obtain a second data set; wherein the quantization scheme amplitude is the difference between an expression with a base of 2 and an integer bit width as an independent variable and an expression with a base of 2 and a negative decimal bit width as an independent variable;

[0034] The minimum integer bit width that meets a preset condition is determined as the integer bit width of the intermediate variable; wherein the preset condition is: the ratio of the number of data in the second data set to the number of data in the first data set is less than or equal to a preset threshold.

[0035] The present invention also provides an automatic mixed precision quantization device, comprising:

[0036] A variable acquisition module, used to acquire intermediate variables to be quantified generated by the MIMO detector in the process of performing signal detection on the MIMO system;

[0037] A first quantization module is used to train the intelligent agent through a deep reinforcement learning algorithm, and quantize the decimal width of each of the intermediate variables based on the strategy stored in the trained intelligent agent;

[0038] The second quantization module is used to quantize the integer bit width of each intermediate variable based on a probability density function.

[0039] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, an automatic mixed precision quantization method as described above is implemented.

[0040] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the automatic mixed precision quantization methods described above.

[0041] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the automatic mixed precision quantization method as described above is implemented.

[0042] The present invention provides an automatic mixed precision quantization method and device, which trains an intelligent agent through a deep reinforcement learning algorithm, and quantizes the decimal bit width of each intermediate variable to be quantized based on the strategy stored in the trained intelligent agent, which can automatically realize the allocation of decimal bit widths of different intermediate variables; then, the integer bit width of each intermediate variable is quantized, which can automatically realize the allocation of integer bit widths of different intermediate variables. Therefore, the present invention can automatically realize the allocation of quantization bit widths of different intermediate variables in a MIMO detector, avoid a large amount of quantization bit width redundancy, and save hardware resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 It is a flowchart of the automatic mixed precision quantization method provided by the present invention;

[0045] Figure 2 is the number of different extraction variables N provided by the present invention ext In this case, the reward value changes with the number of network updates;

[0046] Figure 3The present invention provides a floating point AMP detector and a ext BER performance comparison chart of small number AMP detectors under;

[0047] Figure 4 The present invention provides a -3 When different N ext Comparison of the average fractional width of the value and the SNR loss;

[0048] Figure 5 The present invention provides different L a In this case, the reward value changes with the number of network updates;

[0049] Figure 6 It is a BER performance comparison diagram of the floating point AMP detector, the fractional quantization AMP detector and the fractional integer quantization AMP detector provided by the present invention;

[0050] Figure 7 It is a BER performance comparison diagram of the AMP detector provided by the present invention and the unified quantization AMP detector using different decimal bit widths;

[0051] Figure 8 It is a structural schematic diagram of the automatic mixed precision quantization device provided by the present invention;

[0052] Fig. 9 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] Please refer to Figure 1 , Figure 1 This is one of the flow charts of the automatic mixed precision quantization method provided by the present invention. Figure 1 As shown, the automatic mixed precision quantization method for a multi-input multi-output MIMO detector provided by the present invention mainly includes the following steps:

[0055] Step 101: obtaining an intermediate variable to be quantized generated by a MIMO detector in the process of performing signal detection on a MIMO system;

[0056] Step 102: Train the agent through a deep reinforcement learning algorithm, and quantize the decimal width of each intermediate variable based on the strategy stored in the trained agent;

[0057] Step 103: quantize the integer bit width of each intermediate variable.

[0058] In step 101, regarding the MIMO system, taking the uplink as an example, assuming that a user terminal is configured with N t Root transmitting antenna, base station configuration N r MIMO system with 100 receive antennas, where N t <N r In general, the MIMO system can be simplified to the following real number domain mathematical model:

[0059] y=Hx+n (1)

[0060] in, represents the received signal vector; Represents the transmitted signal vector; H represents 2N r ×2N t The channel matrix of dimension is assumed in this embodiment to be an independent and identically distributed (iid) Rayleigh channel with a mean of 0 and a variance of 1 / 2N. r , and the receiving end knows the channel conditions; represents additive Gaussian white noise, with a mean of 0 and a variance of

[0061] The MIMO detector is used to perform signal detection on the MIMO system. In this embodiment, the MIMO detector may be a Bayesian message passing (BMP) detector, but this embodiment is not limited thereto, and the MIMO detector may also be other detectors.

[0062] In this step, an intermediate variable to be quantized generated by the MIMO detector in the process of performing signal detection on the MIMO system is obtained. Different MIMO detectors generate different intermediate variables.

[0063] In step 102, the intelligent agent is trained by a deep reinforcement learning algorithm, and the decimal place width of each intermediate variable to be quantized is quantized based on the strategy stored in the trained intelligent agent, so that the decimal place width of different intermediate variables can be automatically allocated.

[0064] Optionally, in step 102, training the agent by a deep reinforcement learning algorithm includes the following sub-steps:

[0065] Step 1021: In each round, the environment is initialized, the agent interacts with the environment based on the Markov decision process, and the interaction data is stored;

[0066] Step 1022, determine whether the preset number of rounds has been reached, if so, proceed to step 1023, if not, proceed to step 1021;

[0067] Step 1023: Control the agent to update the strategy stored in the agent based on the currently stored interaction data;

[0068] Step 1024, determine whether the maximum number of rounds has been reached, if so, the training ends, if not, proceed to step 1021.

[0069] In step 1021, the deep reinforcement learning (DRL) algorithm, as a branch of machine learning (ML), focuses on interacting with the environment to make correct decisions. In this embodiment, it is assumed that the process of interaction between the agent and the environment is a Markov decision process (MDP).

[0070] In each round, the environment is initialized. Assuming that the process of interaction between the agent and the environment is a Markov decision process, the agent can interact with the environment based on the Markov decision process and store the interaction data during the interaction.

[0071] In step 1023, every time a preset number of rounds is reached, the agent updates the strategy stored in the agent based on the currently stored interaction data.

[0072] In this embodiment, the intelligent agent is continuously interacted with the environment based on the Markov decision process, and the intelligent agent is trained through a deep reinforcement learning algorithm, so that the intelligent agent can obtain strategies through learning.

[0073] Optionally, in step 1021, initializing the environment may include:

[0074] Step 10211, randomly extracting multiple intermediate variables;

[0075] Step 10212: Initialize the decimal bit width of all intermediate variables to a preset maximum decimal bit width, and initialize the integer bit width of all intermediate variables to a preset maximum integer bit width;

[0076] Step 10213: determine a plurality of states, where the plurality of states include sequence numbers and decimal place widths corresponding to a plurality of intermediate variables;

[0077] Step 10214: Randomly select and return a state from multiple states.

[0078] In step 10211, considering the strict requirements on bit error rate (BER) performance in MIMO detection and the large correlation between different intermediate variables, considering all intermediate variables in one round will introduce serious reward misjudgment, resulting in poor quantization results. Therefore, in one round, N ext (1<N ext ≤N all ) intermediate variables, and obtain the variable set S ext ; Among them, N ext Represents the number of pre-set randomly selected intermediate variables, N all represents the number of all intermediate variables, S ext represents a set of randomly selected intermediate variables. Although only N ext However, as long as there are enough rounds, the correlations between all variables will be taken into account.

[0079] In step 10213, the state is defined as a vector (oh(k),oh(q k )), where k∈{1,2,...,N all}, k represents the serial number of the kth intermediate variable to be quantified; q k ∈{0,1,...,q max}, q k Indicates the decimal width of the kth intermediate variable, q max Indicates q k The preset maximum value of , that is, the preset maximum decimal place width of the kth intermediate variable; the operation oh() means returning the one-hot encoding value.

[0080] In this step, the decimal widths of the randomly selected intermediate variables are initialized to the preset maximum decimal width q max , so we can get multiple states corresponding to multiple intermediate variables, namely (oh(k'),oh(q max )), k'∈S ext .

[0081] Step 10214: Randomly select and return a state (oh(k'),oh(q k' )), k'∈S ext .

[0082] In this embodiment, a plurality of intermediate variables are first randomly selected, and then the decimal bit widths of all intermediate variables are initialized to a preset maximum decimal bit width, and the integer bit widths of all intermediate variables are initialized to a preset maximum integer bit width. Finally, a state is randomly selected and returned from a plurality of states corresponding to the plurality of intermediate variables, thereby realizing the initialization of the environment.

[0083] Optionally, in step 1021, the agent interacts with the environment based on the Markov decision process and the interaction data is stored, including:

[0084] Step 10215: At each moment, determine the action value according to the current state and the current strategy;

[0085] Step 10216: modify the current quantization scheme according to the action value to obtain a modified quantization scheme;

[0086] Step 10217: Evaluate the modified quantization scheme according to the reward function to obtain a reward value, select and return the next state, and proceed to step 10218; wherein, the interaction data generated at each moment is stored at the same time, and the interaction data includes the state, action value, and reward value;

[0087] Step 10218, determine whether the current moment has reached the maximum moment, if so, go to step 1022, if not, go to step 10215.

[0088] In order to more clearly understand the interaction process between the agent and the environment, we first explain the quantization scheme, action, and reward function respectively, as follows:

[0089] (1) Quantitative solution

[0090] Since linear quantization can be efficiently implemented in hardware, this embodiment adopts linear quantization. The specific quantization scheme is as follows: the sign part, integer part and fractional part are 1, p and q respectively, abbreviated as 1-pq. For the intermediate variable with value v, the quantized value v Q It can be expressed as:

[0091] v Q =round(clip(v,-B,B) / C)×C (2)

[0092] Where B = 2 p -2 -q and C = 2 -q .

[0093] (2) Action

[0094] The action represents the change in the decimal bit width. If the bit width after taking the action (denoted as q' k ) is not in the set {0,1,...,qmax}, you can trim q' k Enter the range [0,q max ] However, this will increase the max The probability (less than 0 or greater than q max The value is forced to 0 or q max ), which makes the agent more likely to stay at the two extreme points. Therefore, if q k Greater than q max , we can start counting from 0; if q k Less than 0, you can max Start the calculation. Therefore, it can be expressed by the following expression with varying decimal places:

[0095] q′ k =q k +a t mod(q max +1) (3)

[0096] Before the agent takes action a t After that, the decimal place width of the kth variable becomes q' k .

[0097] The influence range of the action is defined as the maximum absolute value of the change in the decimal width, denoted as L a Then, the action space It's a collection When L a = 1, the decimal width can only change by 1 digit at most, which may lead to low learning efficiency and easy to fall into the local optimal solution. , the agent can flexibly change the current decimal width to any other decimal width, but this may lead to instability in the learning process and degradation of convergence performance.

[0098] (3) Reward Function

[0099] The reward mainly depends on the BER performance and the fractional bit width. Since MIMO detection has strict performance requirements, the reward function aims to reduce the fractional bit width while ensuring the BER performance.

[0100] Regarding the evaluation of BER performance: Monte Carlo simulation is often used to test the BER performance of a specific detection algorithm. Considering that the accurate BER requires a large number of samples for Monte Carlo simulation, it can be pre-calculated before the agent starts learning, denoted as P b When evaluating the BER performance of the quantized detector, the environment uses a small number of samples to simulate the BER performance of both the floating point detector and the quantized detector to save computation time. The corresponding BERs of the floating point detector and the quantized detector are written as and The BER relative error of the quantized detector is defined as However, due to the small number of simulated samples when evaluating the BER performance of the quantized detector, may be equal to 0. Therefore, use As the relative error. If the relative error is greater than the threshold ε2, the performance of the quantized detector cannot be guaranteed, and the environment returns the reward r t = -1. Otherwise, the environment will take the decimal places into account.

[0101] The average decimal width of all variables in the current quantization scheme is expressed as The reward function when the relative error is less than ε2 is defined as Among them, θ1 and θ2 are empirical parameters. Compared with the linear function, the exponential function allows the environment to return a larger reward value when the decimal width is smaller, which makes the agent more inclined to reduce the decimal width. In summary, the reward function is as follows:

[0102]

[0103] Then, the environment selects the next intermediate variable, recorded as the k'th intermediate variable, and the state is updated to (oh(k'),oh(q k' )).

[0104] Based on the above description, steps 10215-10218 are described in detail below:

[0105] In step 10215, at time t, according to the current state and current strategies Determine the action value in, and They represent the state space and action space respectively, and the strategy is used to characterize the mapping relationship between state and action values.

[0106] In step 10216, according to the action value Modify the current quantization scheme to obtain a modified quantization scheme.

[0107] Current quantization scheme: v Q =round(clip(v,-B,B) / C)×C, where and

[0108] Modified quantization scheme: v Q =round(clip(v,-B',B') / C')×C', where q' k =q k +a t , and

[0109] In step 10217, the modified quantization scheme is evaluated according to the reward function to obtain a reward value represents the reward function, and selects and returns the next state (oh(k'),oh(q k' )).

[0110] In step 10218, at each moment, the agent interacts with the environment once, that is, steps 10215-10217 are executed once. The current moment t refers to the moment when the agent is interacting with the environment. The maximum moment t max Refers to: the preset maximum moment of interaction between the agent and the environment. Repeat the above steps 10215-10217 until the current moment t reaches the maximum moment t max , and stores the interaction data generated at each moment. The interaction data includes state, action value and reward value.

[0111] Optionally, in step 102, the decimal width of each intermediate variable is quantized based on the strategy stored in the trained agent, including:

[0112] Step 1025: convert the strategies stored in the trained agent into a statistical distribution of the decimal width of each intermediate variable through a Monte Carlo simulation algorithm;

[0113] Step 1026: Determine the decimal place width of the intermediate variable based on the statistical distribution of the decimal place width of the intermediate variable.

[0114] In step 1025, the following sub-steps may be included:

[0115] Step 10251: During each test, for each intermediate variable, determine the action value based on the current state of the intermediate variable and the strategy stored in the trained agent;

[0116] Step 10252: Change the decimal place width of the intermediate variable based on the action value;

[0117] Step 10253: determine whether the maximum number of tests has been reached, if so, proceed to step 10254, if not, proceed to step 10251;

[0118] Step 10254, obtaining the frequency of each intermediate variable taking different decimal place widths;

[0119] Step 10255: Obtain the statistical distribution of the decimal place width of each intermediate variable.

[0120] In step 10251, in each test, the intermediate variable selected by the fixed environment each time is the kth intermediate variable, and according to the current state (oh(k),oh(q k )) and current strategies Determine the action value

[0121] In step 10252, based on the action value Change the decimal width q′ of the kth intermediate variable k =q k +a t .

[0122] In step 10254, after the maximum number of tests is reached, the frequency of the kth intermediate variable taking different decimal place widths is obtained.

[0123] In step 10255, once the maximum test time is large enough, the statistical distribution of the decimal width of the kth variable learned by the agent can be approximated.

[0124] In this embodiment, the strategies stored in the trained intelligent agent can be converted into a statistical distribution of decimal places of the intermediate variables through a Monte Carlo simulation algorithm.

[0125] In step 1026, based on the statistical distribution of the decimal place width of the intermediate variable, the mean of the statistical distribution of the decimal place width of the intermediate variable is determined as the decimal place width of the intermediate variable.

[0126] In this embodiment, the mean of the statistical distribution of the decimal place width of the kth variable is calculated as q k An estimate of expected value.

[0127] Optionally, step 103 may include the following sub-steps:

[0128] Step 1031, generating a number of data of each intermediate variable by using a Monte Carlo simulation algorithm to obtain a first data set;

[0129] Step 1032: extract data in the first data set that are not within the quantization scheme amplitude range to obtain a second data set; wherein the quantization scheme amplitude is the difference between an expression with a base of 2 and an integer bit width as an independent variable and an expression with a base of 2 and a negative decimal bit width as an independent variable;

[0130] Step 1033: determine the minimum integer bit width that meets the preset condition as the integer bit width of the intermediate variable; wherein the preset condition is: the ratio of the number of data in the second data set to the number of data in the first data set is less than or equal to a preset threshold.

[0131] In step 1031, a number of data of the k-th variable intermediate variable is generated by a Monte Carlo simulation algorithm to obtain a first data set S.

[0132] In step 1032, for the 1-pq quantization scheme, the quantization scheme amplitude is B=2 p -2 -q , the amplitude range of the quantization scheme is [-B, B], and the data that are not in the range of [-B, B] in the first data set S are extracted to form the second data set S′, S′={v||v|>|B|,v∈S}.

[0133] In step 1033, The minimum integer bit width of is determined as the integer bit width of the intermediate variable, that is,

[0134]

[0135] Wherein, ε1 represents a preset threshold. When ε1=0, card(S′)=0, indicating that the quantization scheme can cover all values ​​of the variable.

[0136] In this embodiment, the integer bit width of each intermediate variable is quantized, so that the integer bit widths of different intermediate variables can be automatically allocated.

[0137] In summary, the present invention provides an automatic mixed precision quantization method for a multi-input multi-output MIMO detector, which trains an intelligent agent through a deep reinforcement learning algorithm, and quantizes the decimal bit width of each intermediate variable to be quantized based on the strategy stored in the trained intelligent agent, which can automatically realize the allocation of decimal bit widths of different intermediate variables; then, the integer bit width of each intermediate variable is quantized, which can automatically realize the allocation of integer bit widths of different intermediate variables. Therefore, the present invention can automatically realize the allocation of quantization bit widths of different intermediate variables in the MIMO detector, avoiding a large amount of quantization bit width redundancy and saving hardware resources.

[0138] The method provided in this embodiment is verified by using a specific example below.

[0139] This embodiment takes the following configuration as an example, the transmission signal vector is uniformly randomly generated from 16QAM modulation, the channel matrix is ​​randomly generated from the Rayleigh channel model with 8 transmitting antennas and 128 receiving antennas, and the MIMO detector is selected as an approximate message passing (AMP) detector, and the number of iterations is set to 4. After some simulation experiments, it is found that ε1=10 -4 ,ε2=0.8,θ1=10 and θ2=4 can achieve a good trade-off between BER performance and quantization bit width. Therefore, these hyperparameters are fixed in the following simulation experiments.

[0140] Both the policy network and the value network consist of a fully connected DNN with 6 hidden layers. The policy network is used to store the policy learned by the agent, and the value network is used to evaluate the value of the current state. The dimensions of the 6 hidden layers are 64, 128, 256, 256, 128, and 64 respectively. The dimensions of the input layer of the policy network and the value network are equal to the dimension of the state space. The dimension of the output layer of the policy network is equal to the dimension of the action space, and the dimension of the value network is 1. The learning rate is set to 0.002, and the agent uses the Proximal Policy Optimization (PPO) algorithm. The attenuation factor in the PPO algorithm is set to 0.99, the ∈ clipping value is set to 0.2, and the decimal width of each variable is learned until the maximum number of rounds is reached.

[0141] The simulation results are analyzed as follows:

[0142] 1)N ext The impact of size

[0143] The relationship between the reward returned by the environment and the number of iterations is as follows Figure 2 As shown. Different N ext In this case, as the number of iterations increases, the reward value first increases and then fluctuates around a certain value, indicating that the agent is learning how to better quantify the intermediate variables in the detection algorithm. ext = 1, since the correlation between different intermediate variables is not considered, the agent can reduce the decimal width of the variable to a very low value, that is, Figure 2 As N ext As increases, the reward value at convergence becomes smaller. This is mainly because the reward misjudgment problem makes it more challenging for the agent to reduce the decimal width.

[0144] The floating-point AMP detector and the fractional AMP detector in this embodiment have different N ext The BER performance comparison under Figure 3 As shown, the legend entry "N ext =1" means N ext = 1, the performance curve of the small number AMP detector in this embodiment is similar to the others. ext = 1, the allocated decimal place width is the smallest, but the performance will be seriously degraded. ext =5,N ext =15 and N ext =21, the performance of the fractional AMP detector is basically the same as that of the floating-point AMP detector.

[0145] Figure 4 The figure shows that at BER = 10-3 When different N ext The horizontal axis represents the average decimal width of the value and the SNR loss. ext The SNR loss of the fractional quantized AMP detector compared to the floating-point AMP detector used as the benchmark. The vertical axis represents the average fractional bit width. Figure 4 As shown, the average decimal width is N ext =1 is the lowest, but its performance loss is large. ext = 5, the fractional AMP detector can allocate less fractional bit width while maintaining the performance of the original algorithm. ext =15 and N ext = 21 performance loss and N ext =5, but the average decimal place width is larger. Therefore, in the following analysis, N ext Fixed to 5.

[0146] 2) L a The impact of size

[0147] Different L a In this case, the reward value changes with the number of network updates as follows Figure 5 As shown. a =1, L a = 2, the convergence performance is slightly better. a =1 and L a = 2, the reward value eventually converges to roughly the same value. a = 5, the convergence speed becomes very slow, and the reward value at convergence is smaller than the other two cases. a When L is too large, the convergence speed and the final decimal width are unsatisfactory. In the following discussion, we will a Fixed to 2.

[0148] 3) Integer Quantization

[0149] After the decimal bit width is obtained, the integer bit width can be calculated according to the above expression (5). Figure 6 The BER performance comparison of floating point AMP detector, fractional quantization AMP detector and fractional integer quantization AMP detector is shown. It can be seen that PDF-based integer quantization can perfectly maintain the BER performance of floating point AMP detector.

[0150] 4) Comparison with the unified quantization scheme

[0151] The automatic mixed precision quantization scheme proposed in this embodiment is compared with the unified quantization scheme. The integer bit width of the unified quantization can be obtained by PDF-based integer quantization, that is, 6 bits. As for the decimal bit width, the BER performance of the floating point AMP detector and the unified quantization AMP detector using different decimal bit widths is compared as follows: Figure 7 As shown. The unified quantization AMP with 4-bit and 5-bit fractional bit width suffers from severe performance degradation. The unified quantization AMP detector with 6-bit fractional bit width can almost perfectly restore the performance of the floating-point AMP detector. Therefore, the quantization scheme of the unified quantization AMP detector is taken as 1-6-6. The comparison of the average bit width of the AMP detector based on automatic mixed precision quantization and the unified quantization AMP detector is shown in Table 1. Compared with the unified quantization AMP detector, the AMP detector based on automatic mixed precision quantization reduces the quantization bit width by 57.2% and 58% in integer bit width and fractional bit width, respectively.

[0152] Table 1 compares the average integer and fractional bit widths of the automatic mixed-precision quantization-based AMP detector and the unified quantization AMP detector.

[0153] Table 1

[0154]

[0155] It can be seen from the above analysis that the automatic mixed precision quantization method of this embodiment avoids a large amount of quantization bit width redundancy because it automatically implements the allocation of quantization bit widths of different intermediate variables in the MIMO detector.

[0156] The automatic mixed precision quantization device provided by the present invention is described below. The automatic mixed precision quantization device described below and the automatic mixed precision quantization method described above can be referenced to each other.

[0157] Please refer to Figure 8 , Figure 8 Schematic diagram of the structure of the automatic mixed precision quantization device provided by the present invention. Figure 8 As shown, the automatic mixed precision quantization device provided by the present invention may include:

[0158] The variable acquisition module 10 is used to acquire the intermediate variables to be quantized generated by the MIMO detector in the process of performing signal detection on the MIMO system;

[0159] A first quantization module 20, used to train the agent through a deep reinforcement learning algorithm, and quantize the decimal width of each intermediate variable based on the strategy stored in the trained agent;

[0160] The second quantization module 30 is used to quantize the integer bit width of each intermediate variable based on a probability density function.

[0161] Optionally, the first quantization module 20 includes:

[0162] The interaction unit is used to initialize the environment in each round, interact the agent with the environment based on the Markov decision process, and store the interaction data;

[0163] An updating unit is used to control the agent to update the strategy stored in the agent based on the currently stored interaction data every time a preset number of rounds is reached, until a maximum number of rounds is reached.

[0164] Optionally, the interaction unit is specifically used for:

[0165] Randomly extract multiple intermediate variables;

[0166] Initialize the decimal width of all intermediate variables to the preset maximum decimal width, and initialize the integer width of all intermediate variables to the preset maximum integer width;

[0167] Determine a plurality of states, wherein the plurality of states include sequence numbers and decimal place widths corresponding to the plurality of intermediate variables;

[0168] A state is randomly selected from the plurality of states and returned.

[0169] Optionally, the interaction unit is specifically used for:

[0170] Perform the following steps at each moment until the current moment reaches the maximum moment, and store the interaction data generated at each moment, the interaction data including state, action value and reward value:

[0171] Determine an action value according to the current state and the current strategy; wherein the action value is used to characterize the change in the decimal place width;

[0172] Modify the current quantization scheme according to the action value to obtain a modified quantization scheme;

[0173] The modified quantization scheme is evaluated according to the reward function to obtain a reward value, and the next state is selected and returned.

[0174] Optionally, the first quantization module 20 includes:

[0175] A statistical distribution unit, used for converting the strategies stored in the trained intelligent agent into a statistical distribution of the decimal place width of each intermediate variable through a Monte Carlo simulation algorithm;

[0176] A decimal bit width quantization unit, configured to quantize the decimal bit width of the intermediate variable based on the statistical distribution of the decimal bit width of the intermediate variable;

[0177] The strategy is used to characterize the mapping relationship between the state and the action value, the state includes the sequence number and decimal place width corresponding to the intermediate variable, and the action value is used to characterize the change in the decimal place width.

[0178] Optionally, the statistical distribution unit is specifically used for:

[0179] The following steps are performed in each test until the maximum number of tests is reached, and the frequency of each intermediate variable taking different decimal place widths is obtained, thereby obtaining the statistical distribution of the decimal place width of each intermediate variable:

[0180] For each of the intermediate variables, determining an action value based on the current state of the intermediate variable and the strategy stored in the trained agent;

[0181] The decimal width of the intermediate variable is changed based on the action value.

[0182] Optionally, the fractional bit width quantization unit is specifically used for:

[0183] Based on the statistical distribution of the decimal place width of the intermediate variable, the mean of the statistical distribution of the decimal place width of the intermediate variable is determined as the decimal place width of the intermediate variable.

[0184] Optionally, the second quantization module 30 is specifically configured to:

[0185] Generate a plurality of data of each intermediate variable by a Monte Carlo simulation algorithm to obtain a first data set;

[0186] Extracting data in the first data set that are not within the quantization scheme amplitude range to obtain a second data set; wherein the quantization scheme amplitude is the difference between an expression with a base of 2 and an integer bit width as an independent variable and an expression with a base of 2 and a negative decimal bit width as an independent variable;

[0187] The minimum integer bit width that meets a preset condition is determined as the integer bit width of the intermediate variable; wherein the preset condition is: the ratio of the number of data in the second data set to the number of data in the first data set is less than or equal to a preset threshold.

[0188] Fig. 9 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 8As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the automatic mixed precision quantization method, which includes:

[0189] Acquire an intermediate variable to be quantized generated by the MIMO detector in the process of performing signal detection on the MIMO system;

[0190] The intelligent agent is trained by a deep reinforcement learning algorithm, and the decimal width of each intermediate variable is quantized based on the strategy stored in the trained intelligent agent;

[0191] The integer bit width of each of the intermediate variables is quantized.

[0192] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0193] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the automatic mixed precision quantization method provided by the above methods, the method comprising:

[0194] Acquire an intermediate variable to be quantized generated by the MIMO detector in the process of performing signal detection on the MIMO system;

[0195] The intelligent agent is trained by a deep reinforcement learning algorithm, and the decimal width of each intermediate variable is quantized based on the strategy stored in the trained intelligent agent;

[0196] The integer bit width of each of the intermediate variables is quantized.

[0197] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the automatic mixed precision quantization method provided by the above methods, the method comprising:

[0198] Acquire an intermediate variable to be quantized generated by the MIMO detector in the process of performing signal detection on the MIMO system;

[0199] The intelligent agent is trained by a deep reinforcement learning algorithm, and the decimal width of each intermediate variable is quantized based on the strategy stored in the trained intelligent agent;

[0200] The integer bit width of each of the intermediate variables is quantized.

[0201] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0202] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0203] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An automatic mixed precision quantization method, characterized in that: include: Obtaining an intermediate variable to be quantized generated by a multiple-input multiple-output MIMO detector in the process of performing signal detection on a MIMO system; The intelligent agent is trained by a deep reinforcement learning algorithm, and the decimal width of each intermediate variable is quantized based on the strategy stored in the trained intelligent agent; quantizing the integer bit width of each intermediate variable based on a probability density function; The step of quantizing the decimal width of each intermediate variable based on the strategy stored in the trained agent includes: Converting the strategies stored in the trained intelligent agent into a statistical distribution of decimal places of each intermediate variable through a Monte Carlo simulation algorithm; quantizing the decimal place width of the intermediate variable based on the statistical distribution of the decimal place width of the intermediate variable; The strategy is used to characterize the mapping relationship between the state and the action value, the state includes the sequence number and decimal place width corresponding to the intermediate variable, and the action value is used to characterize the change in the decimal place width.

2. The automatic mixed precision quantization method according to claim 1, characterized in that: The training of the intelligent agent by a deep reinforcement learning algorithm includes: In each round, the environment is initialized, the agent interacts with the environment based on the Markov decision process, and the interaction data is stored; Every time a preset number of rounds is reached, the agent is controlled to update the strategy stored in the agent based on the currently stored interaction data until a maximum number of rounds is reached.

3. The automatic mixed precision quantization method according to claim 2, characterized in that: The initialization environment includes: Randomly extract multiple intermediate variables; Initialize the decimal width of all intermediate variables to the preset maximum decimal width, and initialize the integer width of all intermediate variables to the preset maximum integer width; Determine a plurality of states, wherein the plurality of states include sequence numbers and decimal place widths corresponding to the plurality of intermediate variables; A state is randomly selected from the plurality of states and returned.

4. The automatic mixed precision quantization method according to claim 3, characterized in that: The Markov decision process is used to interact with the agent and the environment, and the interaction data is stored, including: Perform the following steps at each moment until the current moment reaches the maximum moment, and store the interaction data generated at each moment, the interaction data including state, action value and reward value: Determine an action value according to the current state and the current strategy; wherein the action value is used to characterize the change in the decimal place width; Modify the current quantization scheme according to the action value to obtain a modified quantization scheme; The modified quantization scheme is evaluated according to the reward function to obtain a reward value, and the next state is selected and returned.

5. The automatic mixed precision quantization method according to any one of claims 1 to 4, characterized in that: The method of converting the strategy stored in the trained agent into a statistical distribution of the decimal place width of each intermediate variable by using a Monte Carlo simulation algorithm includes: The following steps are performed in each test until the maximum number of tests is reached, and the frequency of each intermediate variable taking different decimal place widths is obtained, thereby obtaining the statistical distribution of the decimal place width of each intermediate variable: For each of the intermediate variables, determining an action value based on the current state of the intermediate variable and the strategy stored in the trained agent; The decimal width of the intermediate variable is changed based on the action value.

6. The automatic mixed precision quantization method according to any one of claims 1 to 4, characterized in that: The quantizing the decimal place width of the intermediate variable based on the statistical distribution of the decimal place width of the intermediate variable includes: Based on the statistical distribution of the decimal digit width of the intermediate variable, the mean of the statistical distribution of the decimal digit width of the intermediate variable is determined as the decimal digit width of the intermediate variable.

7. The automatic mixed precision quantization method according to claim 1, characterized in that: The step of quantizing the integer bit width of each intermediate variable comprises: Generate a plurality of data of each intermediate variable by a Monte Carlo simulation algorithm to obtain a first data set; Extracting data in the first data set that are not within the quantization scheme amplitude range to obtain a second data set; wherein the quantization scheme amplitude is the difference between an expression with a base of 2 and an integer bit width as an independent variable and an expression with a base of 2 and a negative decimal bit width as an independent variable; The minimum integer bit width that meets a preset condition is determined as the integer bit width of the intermediate variable; wherein the preset condition is: the ratio of the number of data in the second data set to the number of data in the first data set is less than or equal to a preset threshold.

8. An automatic mixed precision quantization device, characterized in that: include: A variable acquisition module, used to acquire intermediate variables to be quantified generated by the MIMO detector in the process of performing signal detection on the MIMO system; A first quantization module is used to train the intelligent agent through a deep reinforcement learning algorithm, and quantize the decimal width of each of the intermediate variables based on the strategy stored in the trained intelligent agent; A second quantization module, configured to quantize the integer bit width of each intermediate variable based on a probability density function; The first quantization module is specifically used for: Converting the strategies stored in the trained intelligent agent into a statistical distribution of decimal places of each intermediate variable through a Monte Carlo simulation algorithm; quantizing the decimal place width of the intermediate variable based on the statistical distribution of the decimal place width of the intermediate variable; The strategy is used to characterize the mapping relationship between the state and the action value, the state includes the sequence number and decimal place width corresponding to the intermediate variable, and the action value is used to characterize the change in the decimal place width.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the automatic mixed precision quantization method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the automatic mixed precision quantization method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Low-precision ADC quantization bit number distribution method based on deep reinforcement learning in non-cellular large-scale distributed MIMO system

    CN113660062A