Adaptive precision prediction device, method, medium, terminal and program product based on micro multi-layer perception
By using an adaptive precision prediction device based on a micro multilayer perceptron, the problem of high energy consumption and low efficiency of floating-point arithmetic units is solved. It achieves item-by-item precision adjustment, dynamically adapts to data distribution, and improves computing efficiency and energy efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI GUANGYU XINCHEN TECHNOLOGY CO LTD
- Filing Date
- 2025-10-28
- Publication Date
- 2026-05-29
AI Technical Summary
Existing floating-point arithmetic units consume a lot of energy and are inefficient when performing calculations with fixed precision. Furthermore, existing precision adjustment methods lack fine-grained adaptive capabilities and cannot dynamically adapt to the instantaneous distribution of data.
An adaptive accuracy prediction device based on a micro multilayer perceptron is adopted. Through multiple feature extraction modules, the original numerical values, tail shape and distribution perception features are extracted from the computational data. Combined with preprocessing and accuracy prediction models, the final accuracy level is generated, and the accuracy is adjusted item by item.
While ensuring the accuracy of the calculation results, it significantly reduces computing energy consumption and the number of data path flips, improves computing efficiency and throughput, dynamically adapts to data distribution, and reduces replay rate.
Smart Images

Figure CN121523638B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of floating-point arithmetic technology, and in particular to an adaptive accuracy prediction device, method, medium, terminal and program product based on a micro multilayer perceptron. Background Technology
[0002] In existing floating-point arithmetic units, such as the IEEE-754 compliant single-precision fused multiply-accumulate (FMA) unit, fixed-precision arithmetic is typically employed. Regardless of the size or importance of the input data, all operations are performed on a uniform full-precision path. While this approach ensures the correctness of the calculation results, it also introduces significant energy consumption issues and inefficiencies.
[0003] In recent years, some computing accelerators have attempted to introduce mixed-precision computing strategies, such as switching between different precision formats like FP32, FP16, and INT8. These methods typically rely on static analysis at the software compiler or system level to determine whether certain operators can be processed with lower precision. However, this precision allocation method depends on static decisions and lacks the ability to adaptively adjust precision at a fine-grained, dot-wise level.
[0004] Furthermore, existing research has proposed dynamic precision control methods based on heuristic rules, such as automatically switching to low precision when computational complexity is low, or reducing precision to save energy when a large exponential difference is detected. However, these methods typically rely on a single feature or simple threshold judgment, failing to comprehensively consider the global modeling of data distribution characteristics and accumulated errors. This can easily lead to overly conservative or overly aggressive precision allocation, resulting in energy waste or errors exceeding the allowable range.
[0005] In the field of neural network inference, some AI chips already support allocating different computational precisions (such as INT8, FP16, FP32, etc.) to different network layers through pre-trained quantization tables or scaling factors. Although these methods can achieve certain results at the layer-wise or block-wise level, they still cannot achieve precise precision control at the dot-wise level, and have the drawbacks of coarse precision allocation and difficulty in dynamically adapting to the instantaneous distribution of data.
[0006] Although some literature has proposed using lightweight controllers or predictors to assist hardware scheduling, these solutions usually have the following shortcomings: the input features are singular, only considering the exponential difference or partial product size, lacking overall modeling of the data distribution; and they fail to introduce window-level statistical information such as mean, variance, and histogram separation to reflect the data trend.
[0007] Therefore, it is necessary to provide an adaptive accuracy prediction device, method, medium, terminal, and program product based on a micro multilayer perceptron to solve the above-mentioned problems existing in the prior art. Summary of the Invention
[0008] In view of the shortcomings of the prior art described above, the purpose of this application is to provide an adaptive accuracy prediction device, method, medium, terminal and program product based on a micro multilayer perceptron, to solve the technical problems of the prior art lacking the ability to adjust adaptive accuracy at the fine-grained, dot-wise level, relying only on a single feature for judgment, and being difficult to dynamically adapt to the instantaneous distribution of data.
[0009] To achieve the above and other related objectives, a first aspect of this application provides an adaptive accuracy prediction device based on a micro multilayer perceptron, comprising:
[0010] Multiple feature extraction modules are used to extract the feature of each multiplication-accumulation operation from the input computational data and context data; the feature of each multiplication-accumulation operation includes original numerical features, mantissa shape features and distribution-aware features;
[0011] The preprocessing module is used to preprocess the extracted raw numerical features, tail shape features and distribution sensing features to convert them into a data format suitable for a micro multilayer perceptron.
[0012] The accuracy prediction model construction module is used to input pre-set configuration features and pre-processed raw numerical features, tail shape features and distribution sensing features into the micro multilayer perceptron for training to build an accuracy prediction model; the accuracy prediction model is used to output the probability distribution of each preset accuracy level to obtain the initial accuracy level, and simultaneously output the risk value of selecting the initial accuracy level; the configuration features include energy consumption mode.
[0013] The accuracy level generation module is used to generate the final accuracy level based on the bias added according to different energy consumption modes and the risk value based on the selection threshold mechanism.
[0014] In some embodiments of the first aspect of this application, the original numerical features include: the sign bit, exponent bit, mantissa high-order segment and accumulator exponent obtained by unpacking the arithmetic data according to the IEEE-754 standard, as well as the product exponent and the difference between the product exponent and the accumulator exponent.
[0015] In some embodiments of the first aspect of this application, the mantissa shape feature includes: high-bit non-zero detection data obtained by performing a logical OR operation on the high-bit segment of the mantissa, high-bit difference analysis data obtained by performing a logical XOR operation on the high-bit segment of the mantissa and then performing a counting and grading operation, partial product strength grading, viscous bit prediction, and leading zero prediction.
[0016] In some embodiments of the first aspect of this application, the distribution-aware features include: exponential moving mean and variance, histogram binning, sparsity labeling, offsetting risk, number of remaining terms, and error budget.
[0017] In some embodiments of the first aspect of this application, the configuration feature further includes a pre-defined ULP threshold level.
[0018] In some embodiments of the first aspect of this application, the preprocessing method includes: converting the original numerical features, tail shape features and distribution sensing features into a data format suitable for the micro multilayer perceptron based on a lookup table.
[0019] To achieve the above and other related objectives, a second aspect of this application provides an adaptive accuracy prediction method based on a micro multilayer perceptron, comprising:
[0020] Extract the feature of each multiplication-accumulation operation from the input computational data and context data; the feature of each multiplication-accumulation operation includes the original numerical feature, the shape feature of the last digit, and the distribution-aware feature;
[0021] The extracted raw numerical features, tail shape features, and distribution sensing features are preprocessed to convert them into a data format suitable for a micro multilayer perceptron.
[0022] The pre-defined configuration features, pre-processed original numerical features, tail shape features, and distribution sensing features are input into the micro multilayer perceptron for training to construct an accuracy prediction model. The accuracy prediction model is used to output the probability distribution of each preset accuracy level to obtain the initial accuracy level, and simultaneously outputs the risk value of selecting the initial accuracy level. The configuration features include energy consumption mode.
[0023] Based on the bias added according to different energy consumption modes, and based on the risk value through the selection threshold mechanism, the final accuracy level is generated.
[0024] To achieve the above and other related objectives, a third aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method.
[0025] To achieve the above and other related objectives, a fourth aspect of this application provides a computer program product comprising computer program code that, when executed on a computer, causes the computer to implement the method.
[0026] To achieve the above and other related objectives, a fifth aspect of this application provides an electronic terminal, including a memory, a processor, and a computer program stored in the memory; the processor executes the computer program to implement the method.
[0027] As described above, the adaptive accuracy prediction device, method, medium, terminal, and program product based on a micro multilayer perceptron of this application have the following beneficial effects:
[0028] By extracting multiple features from each multiply-accumulate operation, preprocessing them, and then inputting them into a miniature multilayer perceptron for training, a precision prediction model is constructed. The precision prediction model performs item-by-item precision prediction on the input data. In most cases, the calculation can be completed at a low precision level. While ensuring the accuracy of the calculation results, it significantly reduces the computational energy consumption and the number of data path flips, thereby improving the overall computational efficiency and throughput and avoiding unnecessary full-precision calculations. At the same time, by analyzing the distribution characteristics of the multiple input features, it can dynamically adapt to the instantaneous distribution of data and adjust the selection of the precision level accordingly, reducing the replay rate. Attached Figure Description
[0029] Figure 1 The diagram shown is a schematic of an adaptive accuracy prediction device based on a micro multilayer perceptron in one embodiment of this application.
[0030] Figure 2 The diagram shown illustrates the working principle of an adaptive accuracy prediction device based on a micro multilayer perceptron in one embodiment of this application.
[0031] Figure 3 The diagram shown is a flowchart illustrating an adaptive accuracy prediction method based on a micro multilayer perceptron in one embodiment of this application.
[0032] Figure 4 The diagram shown is a structural schematic of an electronic terminal according to an embodiment of this application. Detailed Implementation
[0033] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0034] In the embodiments of this application, terms such as "first" and "second" are used to distinguish identical or similar items with essentially the same function and effect. For example, "first XX" and "second XX" are merely used to distinguish different XXs and do not limit their order. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different.
[0035] It should be noted that, in the embodiments of this application, the words "exemplary" or "for example" indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0036] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0037] Before providing a further detailed description of the present invention, the nouns and terms used in the embodiments of the present invention are explained, and the nouns and terms used in the embodiments of the present invention are subject to the following interpretations:
[0038] <1> Micro-Multi-layer Perceptron (Micro-MLP): This is an extremely simplified multi-layer perceptron model. While maintaining the basic architecture of MLP (input layer, at least one hidden layer, output layer), it makes it a very small model with extremely low computational cost by strictly limiting the number of neurons (width) in each layer and / or the total number of layers (depth) of the network.
[0039] <2> The IEEE-754 standard defines the representation and operation rules of floating-point numbers.
[0040] <3> The popcount (population count) algorithm calculates how many bits are 1 in the binary representation of an integer.
[0041] <4> LZC (Leading Zero Count): refers to the number of consecutive "0"s in a binary number, starting from the most significant bit, until the first "1" is encountered.
[0042] <5> Exponential Moving Average (EMA): This is a commonly used time series smoothing technique in statistics to analyze data trends. By giving higher weight to the most recent data points, it makes the calculation results more sensitive to recent changes, thus reflecting the latest trends in the data more quickly.
[0043] <6> ULP (Unit in the Last Place): Represents the distance between a floating-point number and its nearest significant floating-point number, which is the value represented by the last significant bit (the least significant bit of the mantissa) of the floating-point number. In computer science, it is used to evaluate the precision and error of floating-point operations.
[0044] <7> One-hot encoding is a special form of binary encoding in which each state or pattern is represented by a unique bit pattern, and at any given time only one bit is active (i.e. set to 1), while the remaining bits are inactive (i.e. set to 0).
[0045] <8> A look-up table (LUT) is a data structure that stores the mapping between data items and their associated output values.
[0046] Existing mixed-precision methods are mostly based on static allocation or hierarchical decision-making, but they cannot dynamically adjust the precision at the dot level based on the instantaneous distribution of the input data, resulting in insufficient overall energy efficiency. Furthermore, traditional threshold-based or heuristic-based dynamic precision switching methods rely solely on single features such as exponent difference or partial product size, failing to comprehensively consider exponent and mantissa distribution, offsetting risks, and window statistics. They also lack analysis of the input data distribution, making it difficult to dynamically adjust for different distribution characteristics. Therefore, this application provides an adaptive precision prediction device, method, medium, terminal, and program product based on a micro multilayer perceptron. By fusing multiple feature data to predict the precision level, it comprehensively reflects the characteristics of the input data. Simultaneously, it introduces distribution-aware features to facilitate the perception of the input data's distribution characteristics, helping to adjust the precision level, reduce playback rate, and achieve intelligent, dynamic, and adaptive prediction of the precision level for each item-by-item floating-point operation of multiply-accumulate operations, improving the ability to control precision at a fine-grained level.
[0047] To facilitate understanding of the embodiments of this application, in conjunction with Figure 1 and Figure 2 Detailed explanation. Figure 1 A schematic diagram of an adaptive accuracy prediction device based on a micro multilayer perceptron is shown in an embodiment of the present invention. Figure 2 This illustration shows a schematic diagram of the working principle of the adaptive accuracy prediction device based on a micro multilayer perceptron in an embodiment of the present invention. The adaptive accuracy prediction device 100 based on a micro multilayer perceptron in this embodiment includes: a multi-feature extraction module 101, a preprocessing module 102, an accuracy prediction model construction module 103, and an accuracy level generation module 104.
[0048] The multi-feature extraction module 101 is used to extract each feature of the multiplication-accumulation operation from the input computational data and context data; the feature of each multiplication-accumulation operation includes the original numerical feature, the tail shape feature and the distribution-aware feature.
[0049] It's important to note that the core of adaptive precision design is determining whether a single multiplication accumulation (dot1) is sensitive to the overall dotN result. Directly comparing with full-precision calculations defeats the purpose of energy / area optimization. Therefore, utilizing local statistics of the mantissa (OR, XOR, coarse product estimation, etc.) requires only a few gates and shifters, consuming almost no additional resources, yet is sufficient to reflect the size and distribution pattern of the mantissa, capturing the main trends affecting the error at minimal cost. For ease of hardware implementation, all features are quantized to INT8 (8-bit integer), INT12 (12-bit integer), or small-width fixed-point. By analyzing the distribution characteristics of the input features, we ensure that the sensitivity of the data is evaluated without sacrificing accuracy, thus achieving adaptive precision adjustment.
[0050] In some embodiments of this application, the raw numerical features include: the sign bit, exponent bit, mantissa high-order segment, and accumulator exponent extracted from the operational data according to the IEEE-754 standard, as well as the product exponent and the difference between the product exponent and the accumulator exponent. These raw numerical features are extracted and simply calculated from the input operational data (a, b) and the current state of the accumulator (acc), resulting in low hardware cost, meeting the requirements of low-overhead design, and forming the basis for subsequent complex computational features.
[0051] Specifically, according to the IEEE-754 standard, the sign bits Sa and Sb of the operation data a and b are unpacked and extracted to obtain this feature. Each floating-point number has a sign bit that determines whether the floating-point number is positive or negative. Only 1 bit is needed to represent it, usually 0 = positive and 1 = negative. The sign bit information helps to "offset the risk" in subsequent judgments (catastrophic errors are more likely to occur when the signs are opposite). According to the IEEE-754 standard, the exponent bits Ea and Eb of the operation data a and b are unpacked and extracted to obtain this feature. The exponent part of the floating-point number adopts the bias representation commonly used in the IEEE-754 standard. The exponent width of a single-precision FP32 is 8 bits, so it is kept consistent here. The exponent directly determines the order of magnitude of the value. Ea and Eb affect the product exponent and the alignment process with the accumulator. According to the IEEE-754 standard, the high-order bits of the mantissa are extracted from the operational data a and b respectively to extract this feature. For example, the high 8 bits (mant_a_hi[7:0], mant_b_hi[7:0]) or 10 / 12 bits of the mantissa are extracted. This is a compromise based on area, which can express the "effective strength" and saves hardware. The mantissa is usually 23 bits (single precision). In this embodiment, only the high 8 to 12 bits are taken as the "representative feature" because the high bits determine the main precision and amplitude of the value. Although the low bits affect the rounding error, the hardware overhead is large and it is not suitable to introduce them directly. Extracting the high bits is a compromise between area / power consumption and information content. According to the IEEE-754 standard, the accumulator exponent E_acc is extracted from the operational data a and b respectively to extract this feature. Furthermore, the product exponent ΔE_prod and the difference between the product exponent and the accumulator exponent ΔE_acc are calculated based on the exponent bits Ea and Eb. The specific formula is as follows:
[0052] ;Formula (1)
[0053] ;Formula (2)
[0054] in, This represents the offset of the exponent, for IEEE-754 single-precision floating-point numbers. It is usually 127.
[0055] The product exponent calculated by formula (1) gives an estimate of the order of magnitude of the product result. That is, when two floating-point numbers are multiplied, the exponents are added and then the bias value is subtracted to obtain ΔE_prod, which gives the order of magnitude of the product result. The width needs to be 9~10 bits because the exponents may exceed the range of a single 8-bit number after being added.
[0056] For ΔE_acc calculated by formula (2), in MAC (Multiply-Accumulate) operation, the product result must be aligned with the number in the accumulator. ΔE_acc is the difference between the "product result exponent" and the "accumulator exponent". This difference determines how much shift is needed for alignment and whether important bits will be lost during low-precision truncation. If ΔE_acc is large, it means that the product term is much smaller than the accumulator term and may fall directly into the lower part of the mantissa, with limited impact; if ΔE_acc is small, it means that the two are close in magnitude, the accumulation sensitivity is high, the risk of low precision is high, and high precision processing is required; if ΔE_acc is negative and the absolute value is small, and the sign bit is opposite, it indicates the risk of high-bit cancellation.
[0057] In some embodiments of this application, the mantissa shape features include: high-order non-zero detection data obtained by performing a logical OR operation on the high-order segments of the mantissa; high-order difference analysis data obtained by performing a logical XOR operation on the high-order segments of the mantissa followed by a counting and grading operation; partial product strength grading; viscous bit prediction; and leading zero prediction. By extracting mantissa shape features, the approximation of the result for the current multiplication operation can be quickly predicted without performing high-precision calculations, thus providing a basis for subsequent decision-making. These mantissa shape features focus on the bit-level pattern of the computational data, because the bit-level pattern directly determines the error characteristics under approximation calculations, rather than the precise value of the result.
[0058] Specifically, the high-order non-zero detection data (OR_hi) obtained by performing a logical OR operation on the high-order bits of the mantissa acts as an efficient filter. If the high-order bits of the two calculated data points contain a "1", the result's magnitude is likely large, thus quickly eliminating the safe range of "decimal × decimal" combinations, reducing false positives in low-precision calculations, and allowing safe entry into the low-precision process. The specific formula is as follows:
[0059] ;Formula (3)
[0060] The most significant bits of the mantissa are XORed to obtain XOR_hi. Then, XOR_hi is counted using algorithms such as popcount to determine the number of "1"s. To further reduce hardware overhead, a tiered approach is used to analyze the high-order bit difference data, assessing the "morphological differences" of the mantissa to evaluate the inherent uncertainty and risk of the multiplication operation. If many bits differ after XOR, it indicates a large difference in numerical distribution, making the result more unpredictable; similarity indicates more stable error. A small popcount value (low difference tier) indicates that the binary patterns of the two most significant bits are very similar, and the resulting error is controllable; a large popcount value (high difference tier) indicates a large difference in the patterns of the two most significant bits, resulting in highly unstable error behavior. This is similar to a fast "pattern matching" operation, preventing low precision from failing when there are large differences. The formula for calculating XOR_hi is as follows:
[0061] ;Formula (4)
[0062] By extracting high-order non-zero detection data and high-order difference analysis data, the sparsity and similarity information of the high-order segments of the last digit are obtained.
[0063] A rough estimate of the intensity of the partial product is obtained to obtain the intensity level pp_est_bin. Specifically, a shortened multiplication (mant_a_hi × mant_b_hi) is performed using the high-order mantissa and then right-shifted to obtain an intensity level of 3 to 4. This is several orders of magnitude cheaper than calculating the complete 23-bit x 23-bit multiplication (mant_a × mant_b), but it is enough to determine whether the result is "very large", "medium" or "very small", which is crucial for deciding how much computing resources to invest.
[0064] The existence of truncation error can be directly predicted by checking if all the discarded lower-order bits are 0. If the prediction is "1", meaning that not all the discarded lower-order bits are zero, it indicates that any truncation operation will inevitably introduce a non-zero error; if the prediction is "0", it indicates that the error is extremely small. Sticky bit prediction (sticky_pred) can almost freely predict whether there will be residuals after truncation, making it a direct indicator of truncation error risk.
[0065] By predicting leading zeros in the high-order bits (lzc_pred), we determine whether the value is close to 1 or close to 0, and the number of bits to shift during normalization of the prediction result. A large number of leading zeros means a sparser result, and the normalization process will shift more significant bits to the right, amplifying the impact of low-order truncation on the final precision, requiring a conservative strategy. In floating-point calculations, the number of leading zeros is highly correlated with effective precision and reflects the dynamic range.
[0066] In some embodiments of this application, the distribution-aware features include: exponential moving average and variance, histogram binning, sparsity labels, offsetting risk, number of remaining terms, and error budget. By extracting the distribution-aware features, based on the overall trend of the current data and the high-risk scenario specific to this operation, the optimal precision level is selected for the current multiplication operation under global resource constraints.
[0067] Specifically, an exponential moving average (EMA) is applied to the absolute values of recent product operations to obtain its exponential moving average (EMA_μ(|a*b|)) and variance (EMA_σ(|a*b|). The mean and variance describe the overall amplitude and volatility of the current data window. The mean captures the overall amplitude level of the tile (block) through EMA, i.e., whether most terms are large or small; the variance captures whether the numerical distribution of the tile (block) is uniform, or whether there is a mixture of large and small values. EMA is used because it is low-cost, asymptotically convergent, can smooth random fluctuations, and only requires fixed-point (8~12 bits), without the need for high-precision floating-point.
[0068] The absolute value of the recent product operation result (|a*b|) is logarithmically quantized and then mapped to a finite histogram bin (HIST_bin) ranging from 0 to 7, resulting in HIST_bin(|a*b|). Logarithmic scaling better compresses the dynamic range of numerical values, allowing the data to maintain good resolution even when it varies widely; the bin numbering provides a snapshot of the discrete energy distribution, which is more sensitive to the tails than a single mean; this operation is low-cost, requiring only simple comparisons and counter operations.
[0069] Sparsity is defined by the proportion of zero or near-zero values within a statistical window, using 2 bits to represent the degree of sparsity, categorized into low, medium, and high sparsity levels, resulting in a sparsity tag. Sparsity means that most items do not affect the accumulation; using lower precision is safer for sparse data. For dense data tiles with large amplitudes, using lower precision carries a greater risk of truncation, thus requiring higher precision. Determining the sparsity tag is very inexpensive, requiring only a comparison between a counter and a threshold, without complex computation.
[0070] The exponential moving mean and variance of the distribution-aware features, histogram binning, and sparsity labels are used to represent "what this segment of data looks like as a whole", thus representing the distribution characteristics of the input data features.
[0071] If `sign(a*b)` and `acc` are accumulated in opposite directions (i.e., one is positive and the other is negative), and the difference in exponents is small (|ΔE_acc|≤2), it indicates a cancellation risk, making the values more unstable and requiring a setting. When a large number + a large number ≈ a very small result, catastrophic cancellation may occur. Low-precision truncation errors may directly mask the true result, leading to precision loss; therefore, precision must be increased to ensure accuracy. Identifying the cancellation risk by checking the sign and exponent difference of the two calculated data, and taking measures to improve precision when the risk is detected, is extremely low-cost but can capture the most dangerous scenarios.
[0072] In large-scale operations (such as dot product and matrix multiplication), the number of remaining multiplication terms is called the number of remaining terms (rem_len). An 8-bit record is used to record how many terms remain to be calculated in the current tile. When the number of remaining terms is large, the impact of a single error is averaged out; however, as the calculation nears completion, the errors of the last few terms are more directly reflected in the result, amplifying the risk. Therefore, dynamic adjustment of precision is necessary to adapt to changes in the number of remaining terms.
[0073] A global ULP error budget is maintained, recording the remaining available value (the remaining amount of the ULP budget), i.e., the error budget (budget_rem). Like an "energy limit," it tells the prediction device how much more precision it can relax; a smaller budget_rem indicates greater conservatism. When budget_rem approaches 0, precision must be strictly maintained to avoid exceeding the tolerance range. Budget_rem is normalized to [0, 255] for easier hardware implementation. If the budget is sufficient, a low-precision mode can be used to improve performance / energy efficiency; if the budget is tight, a more conservative, higher-precision mode must be switched to ensure that the final result of the entire calculation does not exceed the error.
[0074] The aforementioned `rem_len` and `budget_rem` are used to dynamically adjust the calculation precision. `rem_len` records the number of remaining terms, helping the prediction device to dynamically adjust the precision based on the number of remaining terms. `budget_rem` records the global ULP error budget, guiding the prediction device to optimize the use of computing resources while ensuring the accuracy of the final result.
[0075] The preprocessing module 102 is used to preprocess the extracted raw numerical features, tail shape features and distribution sensing features to convert them into a data format suitable for a micro multilayer perceptron.
[0076] In some embodiments of this application, the preprocessing method includes: converting the original numerical features, tail shape features, and distribution sensing features into a data format suitable for the micro multilayer perceptron based on a lookup table. The lookup table is used to implement binning and normalization in hardware, that is, discretizing each feature for various multiplication and accumulation operations, mapping a continuous feature value to a discrete interval to obtain the number of each bin; then mapping the number of each bin to a standard numerical range, thereby obtaining a numerically stable and hardware-friendly input vector (INT8 / INT12) for the micro multilayer perceptron to compute.
[0077] Because the original input features (such as ΔE_acc, mantissa high-order fragment, variance) may have a wide range of values or uneven distribution under different inputs, directly feeding these original feature values into a miniature multilayer perceptron would lead to inconsistent dimensions of different features, increasing the training difficulty; it might even result in some features becoming dominant, causing model skew. Therefore, by using bucketing and normalization operations, these original feature values are mapped to a stable, finite integer interval (e.g., INT8 / INT12), making the scale of all features similar and ensuring the stability of the feature values.
[0078] By employing a lookup table (LUT), the original input feature values (such as the exponential difference ΔE_acc) are retrieved using a lookup table to obtain the corresponding "discrete values." This avoids complex division, square root, and logarithmic operations in hardware, resulting in small-bit-width fixed-point numbers (INT8 / INT12). This leads to low computational latency, low storage bandwidth requirements, and easier implementation for high-frequency operation on ASICs / FPGAs, demonstrating hardware friendliness. Furthermore, transforming the input vector into a uniformly scalable, compact integer vector facilitates INT8 quantization of the weights, allowing the use of efficient INT8 MAC units (such as DSP slices and SIMD). The entire micro multilayer perceptron only needs to process integer inputs within a fixed range, reducing overflow risk and accelerating training and inference convergence.
[0079] The accuracy prediction model construction module 103 is used to input the pre-set configuration features and pre-processed original numerical features, tail shape features and distribution perception features into the micro multilayer perceptron for training to construct an accuracy prediction model; the accuracy prediction model is used to output the probability distribution of each preset accuracy level to obtain the initial accuracy level, and simultaneously output the risk value of selecting the initial accuracy level; the configuration features include energy consumption mode.
[0080] In some embodiments of this application, the preset configuration features further include a pre-set ULP threshold. By using the pre-set ULP threshold and energy consumption mode, the calculation accuracy and energy consumption can be flexibly adjusted in different application scenarios. The input ULP threshold and energy consumption mode features are 24*36 dimensional, and all values are low-bit-width fixed-point values.
[0081] Specifically, τ_ulp represents the maximum allowable ULP error in a single operation within the error budget. The error threshold is pre-divided into several levels, i.e., a tolerance ULP threshold level (τ_ulp_idx) is set, for example {1, 2, 4, 8, 16}, representing the most stringent (1ULP) to the most lenient (16ULP). τ_ulp_idx is the encoding of this level, and integers from 0 to 4 are sufficient. The prediction device of this application can directly compare the estimated error risk; if it exceeds the threshold corresponding to τ_ulp_idx, the accuracy must be upgraded. Thus, the decision of the prediction device in this application is linked to the global error control strategy, rather than only considering local features. Setting ULP threshold levels avoids the prediction device from defining its own safety or unsafety, ensuring that the global error boundary is controlled globally, resulting in greater consistency. Hardware implementation is very simple, requiring only indexing and table lookup.
[0082] For example, three energy consumption modes (e_mode_one-hot) are pre-defined: Eco mode, Balanced mode, and Turbo mode. Eco mode prioritizes energy saving, tending to select lower precision to reduce energy consumption; Balanced mode strikes a balance between precision and energy consumption; Turbo mode prioritizes performance, tending to select higher precision to ensure result quality and throughput. This is represented using 3-bit one-hot encoding, for example: Eco=100, Balanced=010, Turbo=001. This serves as the external bias input for the prediction device in this application, used to adjust the decision threshold. The same set of input features might be judged as acceptable with low precision in Eco mode, but requires increased precision in Turbo mode. This encoding method is simple and direct, avoiding complex mode interpretation within the prediction device. One-hot encoding ensures mutual exclusion between different modes, facilitating multiplexing in hardware circuitry.
[0083] The characteristics of the raw data, the shape of the last digit, the distribution perception characteristics, the ULP threshold and the energy consumption pattern reflect the size and shape of each term in the current multiplication-accumulation operation, the distribution of the window in which it is located, and the current accuracy policy and budget.
[0084] Specifically, the miniature multilayer perceptron is a very small two-layer fully connected network structure. The preprocessed raw numerical features, mantissa shape features, and distribution-aware features are input into the input layer of the miniature multilayer perceptron. The output of the input layer is fed to the hidden layer, which is the first fully connected layer (Dense1). It uses INT8 quantized weights and inputs to reduce computational overhead; and a ReLU activation function is applied afterward to increase non-linearity and help the model capture complex feature relationships. The second fully connected layer (Dense2) refers to the connection from the hidden layer to the output layer, mapping the output of the hidden layer to the final decision result. It also uses INT8 quantization to maintain computational consistency. All operations are INT8 quantized, resulting in simple hardware implementation and extremely low storage overhead. The trained miniature multilayer perceptron can learn "under what conditions to use the minimum feasible accuracy level," capturing the relationship between features such as ΔE_acc, mantissa shape features, and distribution-aware features and the minimum feasible accuracy. Compared to hard-coded threshold rules, using a miniature multilayer perceptron is more flexible, capable of fusing multiple features (distribution statistics + exponential difference + cancel_risk), and automatically learning better selection strategies.
[0085] In some embodiments of this application, the method for automatically generating supervision labels for an accuracy prediction model includes: setting a global ULP error budget for the entire multiply-accumulate operation, representing the maximum ULP that can be tolerated in terms of accumulated error; allocating a corresponding error allowance from the global ULP error budget for each multiply-accumulate operation; attempting accuracy levels from low to high for the current item; if the maximum error generated by the attempted accuracy level is less than the allocated error allowance, then the accuracy level is marked as the supervision label for the current item; otherwise, the process continues to attempt higher levels; deducting the allocated error allowance from the global ULP error budget to update the error budget, and reclaiming any unused error budget for use by subsequent items. By introducing supervision labels, the accuracy prediction model knows "the lowest accuracy level allowed to be used for the current operation item, provided that the global ULP error budget is satisfied."
[0086] The specific formula for allocating the corresponding error allowance from the global ULP error budget for each multiplication-accumulation operation is as follows:
[0087] ;Formula (5)
[0088] in, Indicates the nth term in a multiplication-accumulation operation; Indicates the current remaining budget; Indicates the allocation rate; Indicates the first The weight of the item; This indicates that the allocation result will not be too small or too large; Indicates the minimum amount; This indicates the maximum amount.
[0089] The labels are determined by the real-time features of the current item, such as the HIST_bin feature, cancel_risk feature, ΔE_acc feature, and EMA_σ feature. Specifically, the HIST_bin feature judges the magnitude distribution; a large value assigns a higher weight. The cancel_risk feature indicates the presence of risk, thus requiring more weight. The ΔE_acc feature indicates greater sensitivity when values are close to the target value, requiring higher weight. The EMA_σ feature indicates greater volatility, thus requiring increased weight. Therefore, the generation of supervision labels varies with the distribution of the input data, resulting in automatic label generation.
[0090] In some embodiments of this application, the loss function for training the accuracy prediction model simultaneously considers classification accuracy, energy consumption, recalculation cost, order relation constraints, and risk prediction, and the specific formula is as follows:
[0091] ;Formula (6)
[0092] in, Represents the cross-entropy of categories. This indicates the supervisory label, which represents the minimum pass level. This represents the probability distribution of each accuracy level in the prediction, ensuring that the model can correctly classify to the appropriate accuracy level. This indicates the energy cost, encouraging models not only to classify correctly but also to prioritize the lowest energy consumption level. This indicates the energy consumption cost of each level, which increases monotonically with increasing precision. For example, L0 is the most energy-efficient, and L3 is the most energy-intensive. This represents the expected energy consumption under the predicted distribution; This represents the adjustment factor, which controls the trade-off between energy saving and accuracy. This indicates a replay penalty, which directly penalizes the probability of recalculation caused by the prediction, reducing the number of recalculations and improving pipeline efficiency. The function of regularization in regression is to make the model's errors "mild" and reduce extreme misjudgments; The regularization of the order relation means that the precision levels L0, L1, L2, and L3 are ordered, rather than completely unrelated categories. If the prediction is wrong, it is better to predict the nearest level rather than many levels. This represents the risk prediction branch, which is used to train the risk output branch, enabling the model to have the ability to "estimate uncertainty". Indicates the true risk label; This represents the risk value output by the model; This represents the cross-entropy of binary classification.
[0093] For example, four precision levels are preset, namely L0, L1, L2, and L3. The output layer of the precision prediction model obtained after training has two output heads. One output head originally outputs four logical values (logits[4]) as the main output, which correspond to the four precision levels of L0, L1, L2, and L3 respectively. That is, it scores these four precision levels. These original logits values are converted into probability distributions ([P(L0), P(L1), P(L2), P(L3)]) after passing through the softmax function, indicating which precision level is more suitable for the current dot1 item to be calculated, that is, the initial precision level is output. It should be noted that since the softmax function does not change the order of size, in actual hardware deployment, the softmax function can even be skipped, and the original values of logits can be directly compared. The maximum value (argmax) is selected as the level selection, that is, the argmax level is output, which saves complex calculations and reduces latency and hardware overhead. The other output header outputs a risk value as an auxiliary output, a value between 0 and 1, usually generated by the Sigmoid function. This risk value predicts the probability that a given dot1 item might fail the ULP threshold at the selected initial precision level and require replay for upgrade. Essentially, the risk value represents a probability, providing a warning signal. A low risk value indicates strong model confidence, allowing the use of the predicted initial precision level (argmax level). A high risk value suggests that a higher precision level can be selected in advance to avoid execution followed by replay.
[0094] In this embodiment, a risk value is introduced as an output. If the risk value indicates a high probability that the selected precision level requires an upgrade and recalculation, a higher precision level can be predicted and selected, avoiding recalculation after execution and reducing recalculation overhead. If the risk value of certain processing elements (PEs) is particularly high, the tasks of the PEs can be placed in a more reliable queue, thereby reducing interference to the overall pipeline. The risk value serves as an auxiliary output, providing a confidence level supplement to help the hardware flexibly switch between precision and energy consumption.
[0095] The accuracy prediction model of the adaptive accuracy prediction device based on a micro multilayer perceptron in this application predicts the initial accuracy level for each dot-wise multiply-accumulate operation based on various lightweight features such as the input exponent difference, the high-order bits of the mantissa, and the sign bit. The selection objective is to choose the lowest possible accuracy level while ensuring accuracy constraints, achieving the best balance between power consumption and performance. Always selecting a high accuracy level would lead to wasted energy and overly conservative predictions; selecting a low accuracy level would result in frequent replays and overly aggressive predictions.
[0096] In some embodiments of this application, an online calibration and threshold self-adjustment mechanism is designed for the actual deployed accuracy prediction model to dynamically adjust the threshold and strategy to ensure optimal error control and energy efficiency. Specifically, key runtime statistics are collected, including gear hit count (CNT_LEVEL_HITS[L]), upgrade replay count (CNT_ESCALATE), and error margin histogram (HIST_EBU_MARGIN). CNT_LEVEL_HITS[L] represents the number of times each level (L0–L3) is selected. If there is a long-term excessive bias towards a certain level, it may indicate that the threshold or bias settings are unreasonable. CNT_ESCALATE represents the number of times an upgrade recalculation is triggered due to error budget verification failure. If the upgrade rate is too high, it indicates that the prediction model is too aggressive and the threshold is too loose, and it needs to be tightened. HIST_EBU_MARGIN represents the upper bound margin of the histogram statistical error (error margin under the prediction level). If the margin is often close to 0, it indicates that the current threshold is too risky. If the margin is always large, it indicates that it is too conservative and the energy saving can be relaxed. Based on the aforementioned runtime statistics, a dynamic self-adjustment strategy is employed. When the upgrade rate increases or the error margin is tight, the p_lo and risk thresholds are lowered to make the prediction model more conservative under uncertainty, or the e_mode bias is adjusted to make logits more biased towards higher digits (improving accuracy). When the upgrade rate is too low and the margin is always loose, it indicates that the prediction model is overly conservative. In this case, the p_lo and risk thresholds can be slightly relaxed to increase the utilization of low-precision data and save energy. Feature bucket boundaries are dynamically updated. Specifically, feature inputs (e.g., ΔE_acc, high-order segments of the mantissa, EMA_σ) are usually bucketed or normalized. If the distribution drifts, such as the overall input data becoming larger or smaller, the original bucket boundaries may no longer be suitable. Dynamic updates to the bucket boundaries via the CSR (Configurable Register) are necessary to maintain stable prediction model input and avoid performance degradation caused by distribution drift.
[0097] Even if a high-precision prediction model is trained well, system behavior may drift due to changes in input distribution, operating environment, chip aging, or temperature. Therefore, an online calibration and threshold self-adjustment mechanism is needed. This mechanism should monitor the performance of the prediction device in real time by statistically analyzing the upgrade rate, gear distribution, and error margin, and automatically adjust the threshold (p_lo, risk_th) or e_mode bias as needed to ensure that it neither takes excessive risks nor wastes energy. Simultaneously, it should support dynamic updating of feature bucket boundaries via CSR to ensure the model remains robust during long-term operation.
[0098] The accuracy level generation module 104 is used to generate the final accuracy level based on the bias added according to different energy consumption modes and the risk value based on the selection threshold mechanism.
[0099] Specifically, through a pre-configured energy consumption mode (e_mode), a bias value (bias[e_mode]) set by software through a configuration register (CSR) is added to the original logits value of the main output of the accuracy prediction model, facilitating switching under different power consumption scenarios. Exemplarily, in the Eco mode, points are added to L0 / L1, favoring the selection of low-precision and energy-saving gears; in the Turbo mode, points are added to L2 / L3, favoring the selection of high-precision gears to ensure reliable results. In this way, a system-level energy consumption strategy is provided to quickly adjust the accuracy tendency according to power supply, temperature, and scenarios, without retraining the model, but only by adjusting the bias.
[0100] Meanwhile, a selection threshold mechanism (p_lo, p_hi, r_th) is designed. When selecting the final accuracy gear, not only the argmax gear is considered, but also the probability and risk signals are combined. Without reducing the throughput, the replay upgrade is triggered as little as possible. If max_prob≥p_hi and risk<r_th, the argmax gear is directly selected, which is a high-confidence and low-risk situation; if p_lo≤max_prob<p_hi, the argmax gear is usually selected, but if cancel_risk or ΔE_acc indicates a risk, a conservative upgrade of +1 gear is performed, which is a medium-confidence situation; if max_prob<p_lo or risk≥r_th, a forced conservative upgrade of +1 gear is performed, or even directly jump to L2, which is a low-confidence or high-risk situation. Here, p_lo represents the low confidence threshold; p_hi represents the high confidence threshold; r_th represents the pre-set risk threshold; max_prob represents the maximum confidence of the accuracy prediction model for the selected accuracy gear.
[0101] Through the joint decision-making of the original logits value output, risk output, adding bias to the original logits value according to the energy consumption mode, and the selection threshold mechanism to judge the accuracy gear selection, the prediction device of the present application can generate the final feasible accuracy gear, thereby reducing unnecessary replay upgrades, reducing overhead, ensuring numerical stability, avoiding distortion of numerically sensitive items at low precision, and flexibly adapting to different scenarios (free switching between energy-saving / high-precision modes).
[0102] The final accuracy gear generated by the accuracy gear generation module is the lowest feasible accuracy recognized by the prediction device. Since the accuracy gear is only a category, the final accuracy gear needs to be converted into a hardware-executable control signal, that is, each accuracy gear is mapped to the effective mantissa bits actually participated by the multiplier. For example, L0 = 12b, L1 = 16b, L2 = 20b, L3 = 24b.
[0103] The adaptive accuracy prediction device based on a micro multilayer perceptron in this application dynamically predicts the lowest cost and feasible accuracy level for each multiply-accumulate operation, thereby reducing energy consumption and upgrading recalculation rate.
[0104] Figure 3 This is a flowchart illustrating the adaptive accuracy prediction method based on a micro multilayer perceptron provided in an embodiment of this application. Figure 3 As shown, the adaptive accuracy prediction method based on a micro multilayer perceptron in this application includes the following steps:
[0105] Step S31: Extract the feature of each multiplication-accumulation operation from the input operation data and context data; the feature of each multiplication-accumulation operation includes the original numerical feature, the shape feature of the last digit, and the distribution-aware feature;
[0106] Step S32: Preprocess the extracted raw numerical features, tail shape features, and distribution sensing features to convert them into a data format suitable for a micro multilayer perceptron;
[0107] Step S33: Input the pre-set configuration features and pre-processed original numerical features, tail shape features and distribution sensing features into the micro multilayer perceptron for training to build an accuracy prediction model; the accuracy prediction model is used to output the probability distribution of each preset accuracy level to obtain the initial accuracy level, and simultaneously output the risk value of selecting the initial accuracy level; the configuration features include energy consumption mode.
[0108] Step S34: Based on the bias added according to different energy consumption modes, and based on the risk value according to the selection threshold mechanism, generate the final accuracy level.
[0109] It should be understood that the adaptive accuracy prediction method based on micro multilayer perceptron in this embodiment can achieve the functions of the adaptive accuracy prediction device based on micro multilayer perceptron described above. For the sake of brevity, it will not be described again here.
[0110] It should also be understood that the module division in the embodiments of this application is illustrative and only represents a logical functional division; in actual implementation, there may be other division methods. Furthermore, the functional modules in the various embodiments of this application can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0111] Figure 4 This is a schematic block diagram of the electronic terminal provided in an embodiment of this application. Figure 4As shown, the electronic terminal 400 includes at least one processor 401, a memory 402, at least one network interface 403, and a user interface 405. The various components in the electronic terminal 400 are coupled together via a bus system 404. It is understood that the bus system 404 is used to implement communication between these components. In addition to a data bus, the bus system 404 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 4 The general will label all buses as bus systems.
[0112] The user interface 405 may include a monitor, keyboard, mouse, trackball, clicker, button, touchpad, or touch screen.
[0113] It is understood that memory 402 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM) or programmable read-only memory (PROM), used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM) and synchronous static random access memory (SSRAM). The memories described in the embodiments of this invention are intended to include, but are not limited to, these and any other suitable categories of memory.
[0114] In this embodiment of the invention, the memory 402 is used to store various types of data to support the operation of the electronic terminal 400. Examples of this data include: any executable program for operation on the electronic terminal 400, such as the operating system 4021 and application programs 4022; the operating system 4021 contains various system programs, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and handling hardware-based tasks. The application program 4022 may contain various applications, such as a media player, browser, etc., for implementing various application services. The implementation of the XX method provided in this embodiment of the invention may be included in the application program 4022.
[0115] The methods disclosed in the above embodiments of the present invention can be applied to processor 401, or implemented by processor 401. Processor 401 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 401 or by instructions in the form of software. The processor 401 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 401 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. General-purpose processor 401 may be a microprocessor or any conventional processor, etc. The steps of the accessory optimization method provided in the embodiments of the present invention can be directly reflected as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in a memory. The processor reads the information in the memory and combines it with its hardware to complete the steps of the aforementioned method.
[0116] In an exemplary embodiment, the electronic terminal 400 may be used by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), or complex programmable logic devices (CPLDs) to execute the aforementioned method.
[0117] According to the method provided in the embodiments of this application, this application also provides a computer program product, which includes: computer program code, which, when run on a computer, causes the computer to execute... Figure 3 The method in the illustrated embodiment.
[0118] According to the method provided in the embodiments of this application, this application also provides a computer-readable storage medium storing program code, which, when executed on a computer, causes the computer to perform... Figure 3 The method in the illustrated embodiment.
[0119] As used in this specification, the terms "component," "module," "system," etc., are used to refer to computer-related entities, hardware, firmware, combinations of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or a computer. As illustrated, applications running on computing devices and computing devices can both be components. One or more components may reside in a process and / or an execution thread, and components may be located on a single computer and / or distributed among two or more computers. Furthermore, these components can be executed from various computer-readable media on which various data structures are stored. Components can communicate, for example, via local and / or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system, and / or a network, such as the Internet interacting with other systems via signals).
[0120] Those skilled in the art will recognize that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0121] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0122] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0123] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0124] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0125] In the above embodiments, the functions of each functional unit can be implemented entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. A computer program product includes one or more computer instructions (programs). When the computer program instructions (programs) are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., high-density digital video discs, DVDs), or semiconductor media (e.g., solid-state disks, SSDs, etc.).
[0126] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0127] In summary, addressing the technical problems of existing technologies lacking the ability to adaptively adjust precision at the fine-grained, dot-wise level, relying solely on single feature judgments, and struggling to dynamically adapt to instantaneous data distributions, this application provides an adaptive precision prediction device, method, medium, terminal, and program product based on a micro multilayer perceptron. The constructed precision prediction model predicts the precision of input data item by item, and in most cases, calculations can be completed at a low precision level. While ensuring the precision constraints of the calculation results, it significantly reduces computational energy consumption and the number of data path flips, thereby improving overall computational efficiency and throughput, and avoiding unnecessary full-precision calculations. Furthermore, by using a micro multilayer perceptron, the input features are binned and normalized, resulting in a small number of parameters, low storage footprint, and minimal additional overhead in terms of area and power consumption, achieving low hardware cost. By introducing distributed sensing features, it can adapt to different input distributions and is widely applicable to various scenarios such as dense computing, sparse computing, and numerically sensitive operations. This application can not only be used in a single computing unit but can also be extended to matrix multiply-accumulate arrays, deep learning accelerators, or scientific computing hardware. Therefore, this application effectively overcomes the various shortcomings of the prior art and has high industrial application value.
[0128] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. An adaptive accuracy prediction device based on a micro multilayer perceptron, characterized in that, include: Multiple feature extraction modules are used to extract the feature of each multiplication-accumulation operation from the input computational data and context data; The item-by-item features of the multiplication-accumulation operation include original numerical features, mantissa shape features, and distribution-aware features; The preprocessing module is used to preprocess the extracted raw numerical features, tail shape features and distribution sensing features to convert them into a data format suitable for a micro multilayer perceptron. The accuracy prediction model construction module is used to input pre-set configuration features and pre-processed raw numerical features, tail shape features and distribution sensing features into the micro multilayer perceptron for training to build an accuracy prediction model; the accuracy prediction model is used to output the probability distribution of each preset accuracy level to obtain the initial accuracy level, and simultaneously output the risk value of selecting the initial accuracy level; the configuration features include energy consumption mode. The accuracy level generation module is used to generate the final accuracy level based on the bias added according to different energy consumption modes and the risk value based on the selection threshold mechanism.
2. The adaptive accuracy prediction device based on a micro multilayer perceptron according to claim 1, characterized in that, The original numerical characteristics include: the sign bit, exponent bit, mantissa high-order segment and accumulator exponent obtained by unpacking the operation data according to the IEEE-754 standard, as well as the product exponent and the difference between the product exponent and the accumulator exponent.
3. The adaptive accuracy prediction device based on a micro multilayer perceptron according to claim 2, characterized in that, The mantissa shape features include: high-order non-zero detection data obtained by performing a logical OR operation on the high-order segments of the mantissa, high-order difference analysis data obtained by performing a logical XOR operation on the high-order segments of the mantissa and then performing a counting and grading operation, partial product strength grading, viscous position prediction, and leading zero prediction.
4. The adaptive accuracy prediction device based on a micro multilayer perceptron according to claim 3, characterized in that, The distribution-aware features include: exponential moving mean and variance, histogram binning, sparsity labeling, offsetting risk, number of remaining terms, and error budget.
5. The adaptive accuracy prediction device based on a micro multilayer perceptron according to claim 1, characterized in that, The configuration features also include a pre-defined ULP threshold level.
6. The adaptive accuracy prediction device based on a micro multilayer perceptron according to claim 1, characterized in that, The preprocessing method includes converting the original numerical features, tail shape features, and distribution sensing features into a data format suitable for the micro multilayer perceptron based on a lookup table.
7. An adaptive accuracy prediction method based on a micro multilayer perceptron, characterized in that, include: Extract the feature of each multiplication-accumulation operation from the input computational data and context data; the feature of each multiplication-accumulation operation includes the original numerical feature, the shape feature of the last digit, and the distribution-aware feature; The extracted raw numerical features, tail shape features, and distribution sensing features are preprocessed to convert them into a data format suitable for a micro multilayer perceptron. The pre-defined configuration features, pre-processed original numerical features, tail shape features, and distribution sensing features are input into the micro multilayer perceptron for training to construct an accuracy prediction model. The accuracy prediction model is used to output the probability distribution of each preset accuracy level to obtain the initial accuracy level, and simultaneously outputs the risk value of selecting the initial accuracy level. The configuration features include energy consumption mode. Based on the bias added according to different energy consumption modes, and based on the risk value through the selection threshold mechanism, the final accuracy level is generated.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in claim 7.
9. A computer program product, characterized in that, The computer program product includes computer program code that, when run on a computer, causes the computer to implement the method as described in claim 7.
10. An electronic terminal, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method as described in claim 7.
Citation Information
Patent Citations
Training method of power consumption prediction model, power consumption prediction method and device
CN117436497A
Transform-based acceleration system and method
CN118133908A