Large language model reasoning approximate fault tolerance method based on statistical characteristics
Through the approximate fault-tolerant method of large language model reasoning based on statistical characteristics, error injection simulation and statistical ABFT circuits are used to delineate error danger areas and detect errors in real time, solving the efficiency challenges of the ABFT method in terms of hardware cost and recalculation cost, and achieving Efficient and reliable model inference.
Patent Information
- Application Number
- CN202410726251.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-09-24
AI Technical Summary
Existing ABFT methods have efficiency challenges in terms of hardware cost and recalculation cost, and fail to effectively utilize the error statistical characteristics of large language models, resulting in performance degradation when the error probability is low.
The approximate fault tolerance method of large language model reasoning based on statistical characteristics is used to calculate the fault tolerance characteristic parameters of different computing units through error injection simulation, delineate the error danger area, and detect the severity of the error in the statistical ABFT circuit in real time to decide whether to recalculate. Reduce recalculation overhead.
It significantly reduces model recalculation overhead, improves the efficiency and reliability of model inference, reduces circuit area and power consumption overhead, and protects model performance.
Smart Images

Figure CN118690691A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of design for reliability in electronic design automation and computing systems, and in particular to an approximate fault-tolerant method for reasoning with a large language model based on statistical features. Background Art
[0002] Large language models (LLMs) have shown excellent performance in different natural language processing (NLP) tasks and are increasingly used in reliability-critical tasks such as autonomous driving, aerospace, and healthcare. Large language models have billions of parameters and trillions of operations, and are widely deployed on various systolic array (SA)-based accelerators during inference to improve inference efficiency. However, due to factors such as device aging, process fluctuations, and high-energy particle radiation, it is difficult to ensure that the calculations of these hardware are completely correct without failure.
[0003] In order to improve hardware reliability, people have explored a series of error correction technologies from the circuit level to the algorithm level. Algorithm-based fault tolerance (ABFT) [1] is an algorithm-circuit co-design technology suitable for general matrix-matrix multiplication and an efficient error detection solution. Figure 1 As shown in (a), a row or column of checksums is added to the input matrix and the output matrix respectively. By comparing the checksums, it is possible to detect whether an error has occurred and obtain information about the number and magnitude of the errors. ABFT supports in-situ error correction when a single error occurs, otherwise the error is corrected by recalculation. ABFT can significantly protect the model performance from being affected by hardware errors and has been integrated into systolic arrays [2][3], such as Figure 1 (b) However, ABFT still faces major challenges in terms of efficiency: on the one hand, the hardware cost of the ABFT method is high, especially for quantized large language model reasoning; on the other hand, as the probability of error injection increases, the recalculation cost of ABFT will also increase significantly. The study found that when the error probability is low, the performance of the large language model will not drop immediately, which shows that the large language model itself has a certain fault tolerance. The large language model has the following error statistical characteristics: Figure 2For most of the computational units in (a) and (b), the model can tolerate a small number of large errors and a large number of small errors. Figure 2 (a) O and FC2 computing units or Figure 2 The O and Down computation units in (b) can only withstand a large number of small errors. However, the existing ABFT method does not consider the error characteristics of large models. Therefore, it is of great significance to study how to use the error characteristics of large language models to improve the efficiency of ABFT. Summary of the invention
[0004] In view of the problems existing in the above prior art, a large language model reasoning approximate fault tolerance method based on statistical features is proposed, which is called statistical ABFT. The present invention uses the statistical features of large language model errors to delineate the error risk areas of different computing units of the model, and determines the severity of the error in model reasoning to decide whether to recalculate, thereby reducing the recalculation overhead. The present invention also customizes a real-time error detection circuit to achieve low-cost error statistical feature collection and error severity determination, thereby achieving reliable and efficient model reasoning.
[0005] For ease of understanding, the following lists the names and meanings of the relevant terms defined in the present invention:
[0006] Fault-tolerant computing units: Most computing units in a large language model can withstand a small number of large errors and a large number of small errors. Such computing units are called fault-tolerant computing units, such as key projection (K).
[0007] Sensitive computing units: A small number of computing units in the large language model can only withstand a large number of small errors, but are very sensitive to a small number of large errors. Such computing units include output projection (O) and fc2 (FC2) in the large language model OPT model, and output projection (O) and down projection (Down) in the large language model LLaMA model. These computing units are called sensitive computing units.
[0008] The technical solution of the present invention is as follows:
[0009] A large language model reasoning approximate fault tolerance method based on statistical features, characterized in that the large language model error statistical features are used to implement the large language model reasoning approximate fault tolerance method in a statistical ABFT circuit, and the specific steps are as follows:
[0010] 1) Parameter calculation: Through simulation, error injection is performed to calculate the fault tolerance characteristic parameters of different computing units in the large language model, and the dangerous areas of different computing units are delineated based on these parameters. The specific steps include:
[0011] 1.1) According to the application scenario requirements, select a large language model and corresponding data set, and define an upper limit of model performance loss based on the performance indicators of the task being performed;
[0012] 1.2) Perform error injection simulation on different computing units of the selected large language model, and calculate the performance loss of the large language model under different error conditions by executing the inference process of the model. The injected single error amplitude mag satisfies mag=MSD / feq, where MSD is the matrix sum deviation, freq is the frequency of the injected error, and the three variables mag, MSD, and feq are the error statistical characteristics of the large language model;
[0013] 1.3) According to the performance loss upper limit defined in step 1.1) and the performance loss calculated in step 1.2), the error statistical features mag, MSD, and freq that will have a significant impact on the performance of the large language model are compared, and these errors are demarcated in a danger zone in a coordinate system with log2(MSD) as the horizontal axis and log2(freq) as the vertical axis. The boundary of the danger zone is approximately determined by a horizontal straight line and an inclined straight line with a slope greater than 1. The acute angle area formed by the intersection of the two straight lines is the danger zone; the vertical coordinate of the horizontal straight line is θ freq , the slope of the inclined line is a, the intercept is -b, θ freq , a, b are the fault-tolerant characteristic parameters describing different computing units of the large language model;
[0014] 2) Model deployment: deploying large language models on a systolic array accelerator based on a statistical ABFT circuit;
[0015] 3) Model reasoning and approximate error correction: The operation of model reasoning is to perform multiple matrix multiplication operations of Y=WX on a systolic array of size n×n, where W, X, and Y represent the weight matrix, input matrix, and output matrix, respectively, and are all n×n square matrices; the statistical module of the statistical ABFT circuit is used to calculate and collect the error statistics that appear in the model reasoning: amplitude mag, frequency freq, error amplitude sum MSD, and judge in real time whether the error is serious. If the error is judged to be serious, the recalculation mechanism is triggered to correct the error, otherwise the error is not corrected; the specific steps include:
[0016] 3.1) During model inference, the systolic array performs matrix multiplication operations to calculate the output matrix Y, the input checksum e T WX, and output checksum e T Y, where e T WX and e T Y is a 1×n dimensional vector, e T WX and e TY is calculated in the 2n to 3n-1 cycles and sent to the statistical module of the statistical ABFT circuit. Correspondingly, in the 2n+1 to 3n cycles, the subtractor of the statistical module calculates the e sent in each cycle. T WX and e T The difference of Y is the error in the operation process to be detected. Correspondingly, the statistical module stores and accumulates these differences in the 2n+2 to 3n+1 cycles. On the one hand, these differences are stored in the cache as the error amplitude mag, and on the other hand, the error amplitude is accumulated through the accumulator to obtain MSD;
[0017] 3.2) In the 3n+2 cycle, using the fault tolerance characteristic parameters a and b of different computing units obtained in step 1.3) and the error amplitude sum MSD obtained in step 3.1), calculate the error amplitude threshold θ for different computing units. mag = b - (a - 1) log2MSD;
[0018] 3.3) In the 3n+3 cycle, the conditional counting unit in the statistical module of the ABFT circuit is used to count the error amplitude stored in the cache that is greater than θ mag The error frequency freq eff ;
[0019] 3.4) If freq eff >θ freq , then the error is judged to be in the danger zone and a recalculation is triggered to correct the error. Otherwise,
[0020] This operation is considered safe and does not trigger recalculation, so the next matrix multiplication operation begins.
[0021] Furthermore, the statistical ABFT circuit includes a systolic array, a peripheral circuit and a statistical module, wherein the systolic array is an n×n array composed of n×n multiplication-accumulation processing units PE, each PE supports 8-bit multiplication-accumulation operations, and is used for matrix multiplication operations; the peripheral circuit is used to calculate checksums in model reasoning; the statistical module includes a subtractor, an accumulator, a logarithmic linear calculation unit and n caches with conditional counting functions, which are used to collect statistical characteristics of errors in model reasoning, judge the severity of errors and decide whether to trigger recalculation.
[0022] Further, the systolic array has two data flow structures, namely a weight stationary (WS) data flow structure and an output stationary (OS) data flow structure; when the systolic array data flow is a weight stationary data flow, the peripheral circuit includes n PEs supporting high-bit multiplication located on the opposite side of the systolic array input and n adders on the output side; when the systolic array data flow is an output stationary data flow, the peripheral circuit includes n adders located on the input side, n PEs supporting high-bit multiplication on the output side, and n accumulators.
[0023] The beneficial effects of the present invention are as follows:
[0024] The present invention discloses an approximate fault-tolerant method for large language model reasoning based on statistical features. The fault-tolerant features of the large language model are utilized to delineate the error danger zones of different computing units of the model. In the model reasoning, statistical ABFT circuit calculations are used to collect errors, and only the errors falling into the danger zone are corrected, thereby minimizing the model recalculation overhead. The present invention relaxes the error rate threshold of the model recalculation by 115 times to 2373 times, and further reduces the recalculation delay under different error rates, by at most 4.09 times. The circuit area and power consumption overhead proposed by the present invention are almost negligible, and the model performance is protected. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 The ABFT algorithm and its hardware implementation, where (a) is the algorithm schematic and (b) is the existing circuit diagram of integrating the ABFT algorithm on a systolic array [2];
[0026] Figure 2 Schematic diagram of the model structure of the large language model, where (a) is the structure of the OPT model and (b) is the structure of the LLaMA model;
[0027] Figure 3 It is a flow chart of the approximate fault-tolerant method for large language model reasoning based on statistical features proposed by the present invention;
[0028] Figure 4 is a dangerous area defined in an embodiment of the present invention, wherein (a) is a dangerous area of a fault-tolerant computing unit, and (b) is a dangerous area of a sensitive computing unit;
[0029] Figure 5 It is a statistical ABFT architecture design on a systolic array in an embodiment of the present invention, wherein (a) is the implementation of ABFT under weighted static data flow, (b) is the implementation of ABFT under output static data flow, and (c) is a customized statistical unit. DETAILED DESCRIPTION
[0030] The present invention is further described below through specific implementation cases in conjunction with the accompanying drawings.
[0031] The present invention provides a large language model reasoning approximate error tolerance method based on statistical features, which is mainly divided into three steps: parameter calculation, model deployment, model reasoning and approximate error correction. The flow chart is as follows: Figure 3 shown.
[0032] Parameter calculation: The fault tolerance characteristic parameters of different computing units described in the calculation model are calculated through fault injection simulation, and the dangerous areas of different computing units are delineated based on these parameters. The key projection (fault-tolerant computing unit) and output projection (sensitive computing unit) of the OPT-1.3B model are used as the two computing units ( Figure 2 denoted by K and O respectively in the figure). Consider the performance of the model in the language modeling task on the WikiText-2 dataset. The perplexity is the indicator. The smaller the value, the better the model performance. First, we empirically select a perplexity increase of 0.3 as the upper limit of acceptable performance loss. Then, we perform an error injection simulation on the above-mentioned computing unit, and calculate the performance of the model under different error conditions by executing the inference process of the model. The injected single error amplitude mag satisfies mag = MSD / freq, where MSD is the sum of the error amplitudes, and freq is the frequency of the injected error. For example, when MSD is injected at 2 14 To 2 30 , the error frequency freq is 2 0 To 2 14 The errors between the simulated performance loss and the defined upper limit of the performance loss are compared to determine the statistical characteristics of the errors that have a significant impact on the model performance. In the coordinate system with log2(MSD) as the horizontal axis and log2(freq) as the vertical axis, these errors are demarcated in a danger zone. For key projection, a danger zone can be demarcated. Figure 4 The dangerous area shown in (a) has parameters a=1.273, b=20.076, θ freq =2 5.951 For output projection, we can define a Figure 4 (b) shows the danger zone, whose parameters are a = 1.488, b = 22.949, θ freq =0.
[0033] Model deployment: The OPT-1.3B model is deployed on a systolic array-based accelerator in a statistical ABFT circuit.
[0034] Model inference and approximate error correction: Calculate the matrix multiplication operation Y = WX on an n×n systolic array, where W, X, and Y are all n×n square matrices, each of which includes n 2 elements, respectively, using w 00 , x 01 ,y nn The systolic array has two data flow structures: weight static and output static. During the model inference process, the accelerator may have calculation errors due to factors such as device aging, process fluctuations, and high-energy particle radiation.
[0035] For a data stream with stationary weights, such as Figure 5 The dashed box shown in (a) contains n 2 The systolic array consists of n PEs, and the 8-bit weight values are stored in n 2 In each PE, the 8-bit input X flows from left to right, and the calculated 32-bit partial sum flows from top to bottom. The elements of the i-th row of the input matrix are passed into the array from the left side of the array in sequence starting from the i-th cycle, and the propagation of the row is completed after n cycles. For example, the element x in row 0 00 , x 01 Until x 0n In the 0th to n-1th cycles, the 0th row is fed into the systolic array, and the element x in the 1st row is 10 , x 11 Until x 1n In the 1st to nth cycles, the systolic array is fed in the 1st row, and so on. The last input x nn It will be fed into the systolic array in row n at cycle 2n-1. Each input element will be multiplied by the weight value stored inside the PE as it propagates to the right, and will be accumulated with the partial sum from above before being output from the bottom of the PE. For example, in cycle 0, x 00 and w inside PE at row 0, column 0 00 Multiply to get y 00 The first part and w 00 x 00 , and passed to the PE at row 1, column 0. In the first cycle, w stored inside the array 01 and the x that reaches PE at row 1, column 0 at this time 10 Multiply to get y 00 The second part and w 01 x 10 , and add it to the partial sum transmitted from above, and then output it from below. And so on, in the nth cycle y 00 Complete all multiplication and accumulation operations at row n and column 0, and output y from the bottom of the array 00 =w 00 x 00+w 01 x 10 +w 02 x 20 +…+w 0n x n0 Similarly, the n+1th period y 01 Complete the operation at row n and column 0, y 10 The operation is completed at the first column of the nth row, and they are output from the bottom of the array at the same time. All elements of the Y matrix will be completed and output from the nth cycle to the 3n-2th cycle. Figure 1 In the existing circuit design [2] shown in (b), the peripheral circuit includes a column of accumulators on the left side of the array and a row of accumulators below. The accumulator on the left accumulates the checksum Xe while receiving the X matrix input, that is, x 00 +x 01 +…x 0n , x 10 +x 11 +…+x 1n After the checksums are accumulated, they are sent to the right multiplexed systolic array in the n+1th to 2nth cycles to calculate WXe. However, since Xe usually requires a higher bit width than X, the entire systolic array needs to use a higher bit width multiplier, which will result in huge hardware overhead. In order to solve this problem, the present invention changes the structure of the peripheral circuit and replaces the design in [2] with a column on the right side of the array that supports high-bit multiplication and accumulation operations PE and a column of adders below. In the present invention, Figure 5 As shown in (a), the right column of PEs stores the 16-bit input checksum e T W, that is (w 00 +…+w n0 ),…,(w 01 +…+w n1 ) etc., and is used to calculate e together with the elements of the X matrix passed from PE T WX. The row of adders below the systolic array completes the output checksum e T Accumulation of Y: The adder in column 0 of cycle n receives y 00 Then propagate it to the right. In the n+1th cycle, the adder in the first column adds the y from above. 10 and y coming from the left 00 Add and continue to propagate to the right. At the same time, the adder in column 0 receives y from above. 01 , and it will be sent to the right. And so on, in the 2n cycle, e T The 0th element y of Y 00 +y 10 +…+y n0 The calculation is completed in the accumulator of the nth column. At the same time, eT The 0th element of WX has also completed the calculation. They will be sent to the statistics module for error analysis. This process starts from the 2nth cycle and ends at the 3n-1th cycle. Compared with the existing method [2], this method only needs to add an additional column of n PEs supporting high-bit operations on the right side of the array, instead of n PEs in the entire array. 2 PEs that support high-bit operations greatly reduce the area and power consumption of the accelerator. T WX and e T The latency overhead of Y is also negligible.
[0036] Similarly, in the output static data stream, such as Figure 5 (b) shows that the dashed box is n 2 The PEs are composed of a systolic array, with the initial value of Y stored in the PE being 0. The 8-bit weight W moves horizontally from left to right, while the 8-bit input X moves vertically from top to bottom. The output (y) is completed inside the PE where the weight and input meet. 00 ,y 01 , …, y nn ) is calculated. The elements of the i-th row of the weight matrix W are sent to the i-th row PE from the i-th period to the right, and the elements of the i-th column of the input matrix X are sent to the i-th column PE from the i-th period downward. For example, the element w in the 0th row of the weight matrix W is 00 , w 01 ,…,w 0n Equally sum the 0th column element x of the input matrix X 00 , x 10 , …, x n0 etc. are sequentially fed into the array from the 0th to the n-1th cycle, and the element w in the first row of the weight matrix W is 10 , w 11 ,…,w 1n Equally sum the first column element x of the input matrix X 01 , x 11 , …, x n1 The weights and input values are sent to the array in the first to nth cycles, until all weights and input values are sent to the array in the 2n-1th cycle. In each cycle, each PE will receive a pair of weights and input values at the same time, and PE will multiply them and accumulate them with the internally stored partial sum. For example, in the first cycle, the PE at row 0 and column 1 will receive w from the left. 00 and x from above 01 , PE will multiply it as y 01 The first part and w 00 x 01 In the second cycle, the PE will receive w on the left. 01 and the x above 11PE multiplies it and adds it to the already stored partial sum w 00 x 01 Accumulate and update to y 01 =w 00 x 01 +w 01 x 11 , and so on, in the nth cycle, the PE storage value is updated to y 01 =w 00 x 01 +w 01 x 11 +…+w 0n x n1 ; All output values Y will be accumulated in the 2nth cycle. For the calculation of ABFT, the peripheral circuit of the present invention follows the existing design [3], and a column of adders is integrated on the left side of the array to calculate the 16-bit e T W, a row of PEs supporting high-bit multiplication and accumulation operations is added below the array to calculate e T WX and a row of accumulators are used to calculate e T Y. The functions of the adder on the left and the PE below are similar to the adder below the array and the PE on the right in the weight static data flow, but the output static data flow requires an additional path to calculate e T Y: nth cycle y 00 After the accumulation is completed, it will be sent to the PE below and in the n+1 cycle together with the y that has just been calculated in this cycle. 10 Accumulate, then in the n+2 cycle with y 20 Accumulate, and so on, and get e in the 2n-1 cycle T The first element y of Y 00 +y 10 +…+y n0 , the other elements will be calculated in the 2n to 3n-1 cycles. T Each element of WX also completes the calculation, and they will be sent to the statistics module for error analysis. This process starts from the 2nth cycle and ends at the 3n-1th cycle. Under this data flow, only one row of PEs that can support 16-bit multiplication operations at the bottom of the array needs to be added to the traditional systolic array.
[0037] Through the above calculation, we can get the output matrix Y and the checksum e T Y and e T In order to collect the statistical information of errors according to these results, the present invention designs a statistical module, such as Figure 5As shown in (c), it includes a subtractor, an accumulator, a log-linear operation (Log2LinearFunction) unit and n buffers with conditional counting (countif) functions. The statistics module receives e in the 2n to 3n-1 cycles. T Y and e T WX, and perform subsequent calculations.
[0038] In the statistics module, the subtractor first calculates the checksum e in the 2n+1 to 3n cycles. T Y and e T The differences in WX are stored in the cache from the 2n+2 to the 3n+1 cycles. If these differences are not zero, it means an error has occurred. On the other hand, they are accumulated by the accumulator to obtain the MSD. Then, in the 3n+2 cycle, the log-linear unit uses the parameters a and b and the MSD that has just been accumulated to calculate the error amplitude threshold θ mag In the 3n+3 cycle, the conditional counting unit determines that the value stored in the cache is greater than θ mag The number of elements as freq eff And determine whether to trigger recalculation. The following is a specific numerical example:
[0039] Assume that due to hardware defects, the following statistical characteristics of errors occur in this embodiment: 3 2 4 Amplitude error, 1 2 10 Amplitude error, 2x2 23 Amplitude error, 1 2 28 The magnitude error has an MSD of 2 28.087 That is to say, the cache stores the above 7 errors, and the (n-7) cache elements corresponding to the other elements without errors are all 0. For the fault-tolerant computing unit key projection, a=1.273,b=20.076 are input to the logarithmic linear operation unit, combined with the input MSD value 2 28.087 , the amplitude threshold of the calculation unit is calculated as θ mag = b-(a-1)log2MSD = 12.408, using the conditional counting unit to count the error amplitude greater than 2 12.408 In the assumed error distribution, there are 3 errors that meet the conditions, that is, the effective error frequency freq eff =3<θ freq =2 5.951 , so there is no need to trigger recalculation to correct the error. For the sensitive calculation unit output projection, a=1.488,b=22.949 are input to the logarithmic linear operation unit, combined with the input MSD value 2 28.087 , the amplitude threshold of the calculation unit is calculated as θmag = b-(a-1)log2MSD = 9.242, so only the error amplitude greater than 2 is counted 9.242 In the assumed error distribution, there are 4 errors that meet the conditions, that is, the effective error frequency freq eff =4>θ freq =0, so a recalculation needs to be triggered to correct the error.
[0040] Similarly, other models or other computing units can also achieve approximate fault tolerance through the above method.
[0041] [1]K.-H.Huang and JAAbraham, "Algorithm-based fault tolerance formatrix operations," IEEE Transactions on Computers, vol.100, no.6, pp.518–528, 1984
[0042] [2] S. Bal, CSMummidi, VDC Ferreira, S. Srinivasan, and S. Kundu, "A novelfault-tolerant architecture for tiled matrix multiplication," in 2023 Design, Automation & Test in Europe Conference & Exhibition (DATE), pp. 1–6, IEEE, 2023.
[0043] [3] M. Safarpour, R. Inanlou, and O. Silvén, "Algorithm level error detection in low voltage systolic array," IEEE Transactions on Circuits and Systems II: Express Briefs, vol. 69, no. 2, pp. 569–573, 2021.
[0044] Finally, it should be noted that the purpose of publishing the embodiments is to help further understand the present invention, but those skilled in the art can understand that various substitutions and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the present invention should not be limited to the contents disclosed in the embodiments, and the scope of protection claimed by the present invention shall be subject to the scope defined in the claims.
Claims
1. A large language model reasoning approximate fault tolerance method based on statistical features, characterized in that: By using the statistical characteristics of large language model errors, an approximate fault-tolerant method for large language model reasoning is implemented in a statistical ABFT circuit. The specific steps are as follows: 1) Parameter calculation: Through simulation, error injection is performed to calculate the fault tolerance characteristic parameters of different computing units in the large language model, and the dangerous areas of different computing units are delineated based on these parameters. The specific steps include: 1.1) According to the application scenario requirements, select a large language model and corresponding data set, and define an upper limit of model performance loss based on the performance indicators of the task being performed; 1.2) Perform error injection simulation on different computing units of the selected large language model, and calculate the performance loss of the large language model under different error conditions by executing the inference process of the model. The injected single error amplitude mag satisfies mag=MSD / freq, where MSD is the matrix sum deviation, freq is the frequency of the injected error, and the three variables mag, MSD, and freq are the error statistical characteristics of the large language model; 1.3) According to the performance loss upper limit defined in step 1.1) and the performance loss calculated in step 1.2), the error statistical features mag, MSD, and freq that will have a significant impact on the performance of the large language model are compared, and these errors are demarcated in a danger zone in a coordinate system with log2(MSD) as the horizontal axis and log2(freq) as the vertical axis. The boundary of the danger zone is approximately determined by a horizontal straight line and an inclined straight line with a slope greater than 1. The acute angle area formed by the intersection of the two straight lines is the danger zone; the vertical coordinate of the horizontal straight line is θ freq , the slope of the inclined line is a, the intercept is -b, θ freq , a, b are the fault-tolerant characteristic parameters describing different computing units of the large language model; 2) Model deployment: deploying large language models on a systolic array accelerator based on a statistical ABFT circuit; 3) Model reasoning and approximate error correction: The operation of model reasoning is to perform multiple matrix multiplication operations of Y=WX on a systolic array of size n×n, where W, X, and Y represent the weight matrix, input matrix, and output matrix, respectively, and are all n×n square matrices; the statistical module of the statistical ABFT circuit is used to calculate and collect the error statistics that appear in the model reasoning: amplitude mag, frequency freq, error amplitude sum MSD, and judge in real time whether the error is serious. If the error is judged to be serious, the recalculation mechanism is triggered to correct the error, otherwise the error is not corrected; the specific steps include: 3.1) During model inference, the systolic array performs matrix multiplication operations to calculate the output matrix Y, the input checksum e T WX, and output checksum e T Y, where e T WX and e T Y is a 1×n dimensional vector, e T WX and e T Y is calculated in the 2n to 3n-1 cycles and sent to the statistical module of the statistical ABFT circuit. Correspondingly, in the 2n+1 to 3n cycles, the subtractor of the statistical module calculates the e sent in each cycle. T WX and e T The difference of Y is the error in the operation process to be detected. Correspondingly, the statistical module stores and accumulates these differences in the 2n+2 to 3n+1 cycles. On the one hand, these differences are stored in the cache as the error amplitude mag, and on the other hand, the error amplitude is accumulated through the accumulator to obtain MSD; 3.2) In the 3n+2 cycle, using the fault tolerance characteristic parameters a and b of different computing units obtained in step 1.3) and the error amplitude sum MSD obtained in step 3.1), calculate the error amplitude threshold θ for different computing units. mag = b - (a - 1) log2MSD; 3.3) In the 3n+3 cycle, the conditional counting unit in the statistical module of the ABFT circuit is used to count the error amplitude stored in the cache that is greater than θ mag The error frequency freq eff ; 3.4) If freq eff >θ freq , the error is judged to fall within the danger zone and recalculation is triggered to correct the error. Otherwise, the operation is considered safe and recalculation is not triggered, and the next matrix multiplication operation is entered.
2. The large language model reasoning approximate fault-tolerant method based on statistical features as claimed in claim 1, characterized in that: The statistical ABFT circuit includes a systolic array, a peripheral circuit and a statistical module. The systolic array is an n×n array composed of n×n multiplication-accumulation processing units PE, each PE supports 8-bit multiplication-accumulation operations, and is used for matrix multiplication operations; the peripheral circuit is used to calculate checksums in model reasoning; the statistical module includes a subtractor, an accumulator, a logarithmic linear calculation unit and n caches with conditional counting functions, which are used to collect statistical characteristics of errors in model reasoning, judge the severity of errors and decide whether to trigger recalculation.
3. The large language model reasoning approximate fault-tolerant method based on statistical features as claimed in claim 2, characterized in that: The systolic array has two data flow structures, which are a weight-static data flow structure and an output-static data flow structure; when the systolic array data flow is a weight-static data flow, the peripheral circuit includes n PEs supporting high-bit multiplication located on the opposite side of the systolic array input and n adders on the output side; when the systolic array data flow is an output-static data flow, the peripheral circuit includes n adders located on the input side, n PEs supporting high-bit multiplication on the output side, and n accumulators.
