A large language model acceleration method and implementation device based on low-rank compression
The adaptive cross approximation algorithm is used to perform matrix compression decomposition on the weight matrix of large language models, which solves the problem of high computing resources and reliance on experience in rank selection of large language models, achieves more efficient deployment and fine-tuning, and improves the universality of the model. performance and application efficiency.
Patent Information
- Application Number
- CN202410865324.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-07-01
AI Technical Summary
Existing large language models require a large amount of computing resources during training and deployment, and the selection of low-rank matrix ranks relies on empirical settings, resulting in poor model universality and high computational complexity, making it unable to adapt to the needs of different application scenarios.
The adaptive cross approximation algorithm is used to perform matrix compression decomposition on the weight matrix of the large language model to obtain the rank of the weight matrix, which is applied to the LoRA fine-tuning process. The computational complexity is reduced through the multiplication of matrices U and V, and the rank of the matrix is achieved. Adaptive settings.
It reduces the storage and computing resource requirements of large language models, improves the universality and application efficiency of the model, reduces the computing power threshold in the fine-tuning process, and achieves a more efficient inference process.
Smart Images

Figure CN118396068B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of large language models, and in particular to a large language model acceleration method based on low-rank compression and an implementation device. Background Art
[0002] In recent years, thanks to the support of big data and the enhancement of computing power, artificial intelligence technology has developed rapidly, and large language models based on generative artificial intelligence technology have emerged. It has performed excellently in simulating human thinking logic and language processing capabilities, laying the foundation for the development of intelligent auxiliary tools and intelligent assistants. All walks of life have also begun to explore the application of large language models in their own industries. However, large language models have the characteristics of large parameters, large training data, and large computing power requirements. Their deployment and training require a large amount of storage resources and computing resources. Especially in the training stage, the computing resources required are much higher than those of general artificial intelligence models. Therefore, model fine-tuning technology has been proposed.
[0003] Model fine-tuning technology aims to fine-tune the model based on the pre-trained large language model with less data and computing power, so that the model has customized functions to meet application requirements. Model fine-tuning technology lowers the threshold for customized use of large language models and has been widely promoted and applied. Among them, the fine-tuning technology based on LoRA is widely used. It cleverly utilizes the rank-deficient characteristics of the pre-trained weight matrix of the large language model, divides the weight matrix into the form of two low-rank matrices multiplied, and greatly reduces the computational complexity of the fine-tuning process.
[0004] However, the selection of the rank r of the low-rank matrix is usually based on experience, and then hard-fitted through iterative training. This approach will inevitably reduce the universality of the model, cannot adaptively meet the needs of different situations, and contradicts the concept of intelligence.
[0005] In response to the needs of lightweight deployment and fine-tuning of large language models, the present invention proposes a large language model acceleration method and implementation device based on low-rank compression. Summary of the invention
[0006] In order to remedy the defects of the prior art, the present invention provides a simple and efficient large language model acceleration method based on low-rank compression and an implementation device.
[0007] The present invention is achieved through the following technical solutions:
[0008] A large language model acceleration method based on low-rank compression, firstly utilizes the rank-deficient property of the pre-trained weight matrix of the large language model based on a deep neural network with dense layers, uses an adaptive cross approximation algorithm to perform matrix compression decomposition on the weight matrix of the large language model, and obtains the rank of the weight matrix; then applies the rank of the weight matrix to the low-rank parameterized update matrix in the LoRA fine-tuning process, and performs fine-tuning training as its set rank, thereby realizing adaptive setting of the update matrix rank and further reducing the computing power threshold for using large language models.
[0009] The following steps are involved:
[0010] Step S1, sparsely store the elements of the weight matrix W of the large language model in the format of row index number, column index number, element value;
[0011] Step S2, using an adaptive cross approximation algorithm to perform matrix compression decomposition on the weight matrix W, decomposing the weight matrix W with a dimension of m×n into two low-dimensional matrices, a matrix U and a matrix V with dimensions of m×r and r×n respectively, W=U·V, and obtaining the rank r of the weight matrix;
[0012] The rank of the weight matrix r<<min(m,n), and its value is adaptively obtained according to different weight matrices;
[0013] Step S3: Replace the weight matrix with the matrix U and matrix V obtained by matrix decomposition and compression for storage, thereby reducing the storage resource requirements for large language model deployment;
[0014] Step S4: before fine-tuning the large language model based on LoRA, the rank r obtained in step S2 is set to the rank of the low-rank parameterized update matrix ΔW corresponding to the weight matrix W, and fine-tuning training is performed to obtain the matrix A and the matrix B, where ΔW = A·B;
[0015] Step S5: Storing matrix A and matrix B as update matrices of the fine-tuned large language model;
[0016] Step S6: When using the fine-tuned large language model for inference, for the input vector, use the matrices compressed in step S2, matrix U and matrix V, and the updated matrices in step S5, matrix A and matrix B, to perform matrix-vector multiplication to complete the inference. This reduces the computational complexity of the inference process and reduces the computing power threshold for using the large language model.
[0017] In step S1, elements whose element value is 0 or whose value is less than 1000 times of other element values are skipped and not stored.
[0018] In step S2, the specific steps of performing matrix compression decomposition on the weight matrix W are as follows:
[0019] Step S2.1, set the iterative convergence error ε, define I = [I 1 ...I r ] and J=[J 1 ...J r ] is an array containing the row and column indices selected from the weight matrix W, u j is the vector consisting of the j-th column elements of the matrix U, v i is the vector of elements in the i-th row of the matrix V, and W(I 1 ,:) represents the Ith 1 OK, Process Matrix The approximate matrix obtained in the kth loop;
[0020] Step S2.2: Before the cycle starts, perform initialization operations;
[0021] Step S2.3: After the initialization operation is completed, perform k cycles to update the approximate matrix. In step S2.2, the initialization operation steps are as follows:
[0022] Step S2.2.1, initialize the first row index number I 1 =1, let the process matrix
[0023] Step S2.2.2: Initialize the Ith 1 Row element value:
[0024] R(I 1 ,:)=W(I 1 ,:)
[0025] Step S2.2.3, in the first 1 Find the maximum value in the row to determine the first column index J l :
[0026] |R(I 1 ,J 1 )|=max j (|R(I 1 ,j)|)
[0027] Step S2.2.4, get the first row element value of matrix V:
[0028] v 1 =R(I l ,:) / R(I 1 ,1)
[0029] Step S2.2.5: Initialize the Jth approximation error matrix l Column element value:
[0030] R(:,J 1 )=W(:,J 1 )
[0031] Step S2.2.6, get the first column element value of matrix U:
[0032] u 1 =R(:,J 1 )
[0033] Step S2.2.7: Calculate the approximate matrix The 2-norm squared:
[0034]
[0035] Step S2.2.8, in the J l Find the maximum value in the column to determine the second row index number I 2 :
[0036] |R(I 2 ,J 1 )|=max i (|R(i,J 1 )|), i≠I 1 .
[0037] In step S2.3, the specific steps are as follows:
[0038] Step S2.3.1, update the Ith k OK:
[0039]
[0040] in, represents the p-th column and the I-th column of the matrix U k elements;
[0041] Step S2.3.2, in the first k Find the maximum value in the row to determine the kth column index J k :
[0042] |R(I k ,J k )|=max j (|R(I k ,j)|), j≠J 1 , ..., J k-1 ;
[0043] Step S2.3.3, get the kth row of matrix V:
[0044] v k =R(I k,:) / R(I k ,J k )
[0045] Step S2.3.4, update the \(J\)-th column of the approximation error matrix: k Column:
[0046]
[0047] Wherein, represents the element in the \(p\)-th row and \(J\)-th column of matrix \(V\); k Element;
[0048] Step S2.3.5, obtain the \(k\)-th column of matrix \(U\):
[0049] u k = R(:,J k )
[0050] Step S2.3.6, calculate the square of the 2-norm of the approximation matrix:
[0051]
[0052] Wherein, represents the transpose of vector \(u\) j .
[0053] Step S2.3.7, determine whether the convergence error is satisfied: If then the iteration ends, \(r = k\); otherwise, start the \((k + 1)\)-th iteration.
[0054] In the said step S6, when using the fine-tuned large language model for inference, for the input vector \(x\), the corresponding output \(h\) is:
[0055] h = W·x + ΔW·x = U·V·x + A·B·x
[0056] The computational complexity of the inference process is \(O(r(m + n))\). In the case of \(r << min(m, n)\), the computational complexity is much less than the original computational complexity \(O(mn)\), further reducing the computing power threshold for using the large language model.
[0057] An implementation device for an acceleration method of a large language model based on low-rank compression, comprising a matrix processing and storage module, a matrix compression and decomposition module, a model fine-tuning module, and a model inference module;
[0058] The said matrix processing and storage module is used to sparsely and explicitly store the weight matrix elements according to the format, and the storage format is row index number, column index number, element value. For elements with an element value of 0 or a value less than 1000 times that of other elements, they are skipped and not stored; and matrices \(U\), \(V\), \(A\), and \(B\) are stored;
[0059] The matrix compression and decomposition module is used to perform matrix compression and decomposition on the weight matrix by using the adaptive cross-approximation algorithm according to the process in step S2, and decompose the weight matrix W with dimensions of m×n into two matrices U and V with dimensions of m×r and r×n respectively, where r is the rank of the weight matrix, and r << min(m, n), that is, W = U·V;
[0060] The model fine-tuning module is used to perform LoRA-based fine-tuning on the large language model, set the rank r obtained in the matrix compression and decomposition module as the rank of the low-rank parameterized update matrix ΔW corresponding to the weight matrix W, and perform fine-tuning training to obtain matrices A and B, where ΔW = A·B;
[0061] The model inference module is used to complete the inference of the fine-tuned large language model. For the input vector x, the corresponding output h is: h = W·x + ΔW·x = U·V·x + A·B·x.
[0062] A large language model acceleration device based on low-rank compression, characterized in that it includes a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method steps when executing the computer program.
[0063] A readable storage medium, characterized in that a computer program is stored on the readable storage medium, and the computer program implements the above method steps when executed by a processor.
[0064] The beneficial effects of the present invention are as follows: The large language model acceleration method and implementation device based on low-rank compression not only reduce the storage resource requirements of the large language model during deployment, but also realize the adaptive matching of the rank value of the low-rank parameterized update matrix during the fine-tuning process, avoiding the problems of application limitations and inability to achieve the best fine-tuning effect caused by manually setting the rank, improving the universality of the application, and further reducing the computational complexity during the inference process of the fine-tuned large language model, lowering the computing power threshold for using the large language model, and accelerating the implementation of the large language model. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0066] Attached Figure 1 It is a schematic diagram of the large language model acceleration method based on low-rank compression of the present invention.
[0067] Attached Figure 2 This is a schematic diagram comparing the inference process of the large language model after fine-tuning of the present invention with the inference process of the general large language model after fine-tuning based on LoRA. Detailed implementation manners
[0068] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
[0069] For the large language model acceleration method based on low-rank compression, first, using the rank deficiency characteristic of the pre-trained weight matrix of the large language model based on the deep neural network with dense layers, the adaptive cross approximation algorithm is used to decompose the weight matrix of the large language model, and the rank of the weight matrix is obtained; then the rank of the weight matrix is applied to the low-rank parameterized update matrix in the LoRA fine-tuning process as the set rank for fine-tuning training, realizing the adaptive setting of the update matrix rank, and further reducing the computing power threshold for using the large language model.
[0070] As shown in the appendix Figure 1 The large language model acceleration method based on low-rank compression includes the following steps:
[0071] Step S1: Sparsely and explicitly store the elements of the weight matrix W of the large language model, and the storage format is row index number, column index number, and element value;
[0072] Step S2: Use the adaptive cross approximation algorithm to decompose the weight matrix W. Decompose the weight matrix W with dimension m×n into two low-dimensional matrices, matrix U with dimension m×r and matrix V with dimension r×n, W = U·V, and obtain the rank r of the weight matrix;
[0073] The rank r of the weight matrix << min(m,n), and its value is adaptively obtained according to different weight matrices;
[0074] Step S3: Replace the weight matrix with the matrices U and V obtained by matrix decomposition and compression for storage, reducing the storage resource requirements for the deployment of the large language model;
[0075] Among them, the dimension of matrix U is m×r, and the dimension of matrix V is r×n. Therefore, the storage ratio of storing matrix U and matrix V is O(r(m + n)). Because r << min(m,n), compared with the weight matrix W with a storage ratio of O(mn), the required storage resources will be greatly reduced, reducing the storage resource requirements for the deployment of the large language model.
[0076] Step S4: Before fine-tuning the large language model based on LoRA, the rank r obtained in step S2 is set to the rank of the low-rank parameterized update matrix ΔW (dimension m×n) corresponding to the weight matrix W, and fine-tuning training is performed to obtain matrix A (dimension m×r) and matrix B (dimension r×n), where ΔW=A·B;
[0077] Step S5: Storing matrix A and matrix B as update matrices of the fine-tuned large language model;
[0078] Step S6: When using the fine-tuned large language model for inference, for the input vector, use the matrices compressed in step S2, matrix U and matrix V, and the updated matrices in step S5, matrix A and matrix B, to perform matrix-vector multiplication to complete the inference. This reduces the computational complexity of the inference process and reduces the computing power threshold for using the large language model.
[0079] In step S1, elements whose element value is 0 or whose value is less than 1000 times of other element values are skipped and not stored.
[0080] In step S2, the specific steps of performing matrix compression decomposition on the weight matrix W are as follows:
[0081] Step S2.1, set the iterative convergence error ε, define I = [I 1 ...I r ] and J=[J 1 ...J r ] is an array containing the row and column indices selected from the weight matrix W, u j is the vector consisting of the j-th column elements of the matrix U, v i is the vector of elements in the i-th row of the matrix V, and W(I 1 ,:) represents the Ith 1 OK, Process Matrix The approximate matrix obtained in the kth loop;
[0082] Step S2.2: Before the cycle starts, perform initialization operations;
[0083] Step S2.2.1, initialize the first row index number I 1 =1, let the process matrix Step S2.2.2: Initialize the Ith 1 Row element value:
[0084] R(I 1 ,:)=W(I 1 ,:)
[0085] Step S2.2.3, in the first 1 Find the maximum value in the row to determine the first column index J l :
[0086] |R(I 1 ,J 1 )|=max j (|R(I 1 ,j)|)
[0087] Step S2.2.4, get the first row element value of matrix V:
[0088] v 1 =R(I l ,:) / R(I 1 ,1)
[0089] Step S2.2.5: Initialize the Jth approximation error matrix l Column element value:
[0090] R(:,J 1 )=W(:,J 1 )
[0091] Step S2.2.6, get the first column element value of matrix U:
[0092] u 1 =R(:,J 1 )
[0093] Step S2.2.7: Calculate the approximate matrix The 2-norm squared:
[0094]
[0095] Step S2.2.8, in the J l Find the maximum value in the column to determine the second row index number I 2 :
[0096] |R(I 2 ,J 1 )|=max i (|R(i,J 1 )|), i≠I 1 .
[0097] Step S2.3: After the initialization operation is completed, perform k cycles to update the approximate matrix. The specific steps are as follows: Step S2.3.1: Update the first I-th approximate error matrix k OK:
[0098]
[0099] in, represents the p-th column and the I-th column of the matrix U k elements;
[0100] Step S2.3.2, in the first k Find the maximum value in the row to determine the kth column index J k :
[0101] |R(I k ,J k )|=max j (|R(I k ,j)|), j≠J 1 , ..., J k-1 ;
[0102] Step S2.3.3, get the kth row of matrix V:
[0103] v k =R(I k ,:) / R(I k ,J k )
[0104] Step S2.3.4: Update the Jth approximation error matrix k List:
[0105]
[0106] in, represents the p-th row and the J-th row of the matrix V k elements;
[0107] Step S2.3.5, get the kth column of matrix U:
[0108] u k =R(:,J k )
[0109] Step S2.3.6, calculate the 2-norm square of the approximate matrix:
[0110]
[0111] in, Represents vector u j The transpose of .
[0112] Step S2.3.7, determine whether the convergence error is satisfied: If Then the iteration ends, r=k; otherwise, the k+1th iteration starts.
[0113] In step S6, when the fine-tuned large language model is used for reasoning, for the input vector x, the corresponding output h is:
[0114] h = W·x + ΔW·x = U·V·x + A·B·x
[0115] As shown in the appendix Figure 2 As shown, the use of the fine-tuned model is realized in the above manner. The computational complexity of this inference process is O(r(m + n)). When r << min(m, n), the computational complexity is much lower than the original computational complexity O(mn), further reducing the computing power threshold for using large language models.
[0116] The implementation device of the large language model acceleration method based on low-rank compression is characterized in that it includes a matrix processing and storage module, a matrix compression and decomposition module, a model fine-tuning module, and a model inference module;
[0117] The matrix processing and storage module is used to sparsely and explicitly store the weight matrix elements according to the format. The storage format is row index number, column index number, element value. For elements with an element value of 0 or a value less than 1000 times that of other elements, they are skipped and not stored; and matrices U, V, A, and B are stored;
[0118] The matrix compression and decomposition module is used to perform matrix compression and decomposition on the weight matrix according to the process in step S2, using the adaptive cross approximation algorithm to decompose the weight matrix W with dimensions m×n into two matrices U and V with dimensions m×r and r×n respectively, where r is the rank of the weight matrix, and r << min(m, n), that is, W = U·V;
[0119] The model fine-tuning module is used to perform LoRA-based fine-tuning on the large language model, set the rank r obtained in the matrix compression and decomposition module as the rank of the low-rank parameterized update matrix ΔW corresponding to the weight matrix W, and perform fine-tuning training to obtain matrices A and B, where ΔW = A·B;
[0120] The model inference module is used to complete the inference of the fine-tuned large language model. For the input vector x, the corresponding output h is: h = W·x + ΔW·x = U·V·x + A·B·x.
[0121] The large language model acceleration device based on low-rank compression includes a memory and a processor; the memory is used to store computer programs, and the processor is used to implement the above method steps when executing the computer programs.
[0122] A computer program is stored on the readable storage medium, and when the computer program is executed by the processor, the above method steps are implemented.
[0123] In summary, the large language model acceleration method and implementation device based on low-rank compression use an adaptive cross approximation algorithm to perform matrix compression decomposition on the weight matrix of the large language model, reduce the storage resource requirements of the large language model during the deployment process, and apply the rank r obtained by matrix compression to the low-rank parameterized update matrix in the LoRA fine-tuning process as its set rank for fine-tuning training, which can avoid the application limitations and fine-tuning effects that cannot be achieved by manually setting the rank, achieve adaptive matching of the entire process, improve the universality of the application, and thus reduce the computational complexity of the reasoning process of the large language model after fine-tuning, reduce the computing power threshold for the use of large language models, and accelerate the implementation of large language models.
[0124] The above is a detailed introduction to a large language model acceleration method and implementation device based on low-rank compression in an example of the present invention. This section uses specific examples to illustrate the principles and implementation methods of the invention. The above examples are only used to help understand the core ideas of the present invention. Without departing from the principles of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
Claims
1. A large language model acceleration method based on low-rank compression, characterized by: Firstly, the rank-deficient property of the pre-trained weight matrix of a large language model based on a deep neural network with dense layers is utilized, and the weight matrix of the large language model is compressed and decomposed using an adaptive cross approximation algorithm to obtain the rank of the weight matrix. Then, the rank of the weight matrix is applied to the low-rank parameterized update matrix in the LoRA fine-tuning process as its set rank for fine-tuning training, thus realizing the adaptive setting of the update matrix rank. The following steps are involved: Step S1, sparsely store the elements of the weight matrix W of the large language model in the format of row index number, column index number, element value; Elements whose value is 0 or whose value is 1000 times less than other elements are skipped and not stored. Step S2, using an adaptive cross approximation algorithm to perform matrix compression decomposition on the weight matrix W, decomposing the weight matrix W with a dimension of m×n into two low-dimensional matrices, a matrix U and a matrix V with dimensions of m×r and r×n respectively, W=U·V, and obtaining the rank r of the weight matrix; The rank of the weight matrix r<<min(m,n), and its value is adaptively obtained according to different weight matrices; The specific steps of matrix compression decomposition of the weight matrix W are as follows: Step S2.1, set the iterative convergence error ε, define I = [I1...I r ] and J=[J1...J r ] is an array containing the row and column indices selected from the weight matrix W, u j is the vector consisting of the j-th column elements of the matrix U, v i is a vector consisting of the elements of the i-th row of the matrix V, and W(I1,:) represents the I1-th row of the weight matrix W, Process Matrix The approximate matrix obtained in the kth loop; Step S2.2: Before the cycle starts, perform initialization operations; Step S2.2.1, initialize the first row index number I1 = 1, let the process matrix Step S2.2.2, initialize the I1th row element value of the approximate error matrix R: R(I1,:)=W(I1,:) Step S2.2.3: Find the maximum value in row I1 to determine the first column index number J l : |R(I1,J1)|=max j (|R(I1,j)|) Step S2.2.4, get the first row element value of matrix V: v1=R(I l ,:) / R(I1,1) Step S2.2.5: Initialize the Jth approximation error matrix l Column element value: R(:,J1)=W(:,J1) Step S2.2.6, get the first column element value of matrix U: u1=R(:,J1) Step S2.2.7: Calculate the approximate matrix The 2-norm squared: Step S2.2.8, in the J l Find the maximum value in the column to determine the second row index I2: |R(I2,J1)|=max i (|R(i,J1)|),i≠I1; Step S2.3, after the initialization operation is completed, perform k loop operations to update the approximate matrix; Step S2.3.1, update the Ith k OK: in, represents the p-th column and the I-th column of the matrix U k elements; Step S2.3.2, in the first k Find the maximum value in the row to determine the kth column index J k : |R(I k ,J k )|=max j (|R(I k ,j)|),j≠J1,...,J k-1 ; Step S2.3.3, get the kth row of matrix V: v k =R(I k ,:) / R(I k ,J k ) Step S2.3.4: Update the Jth approximation error matrix k List: in, represents the p-th row and the J-th row of the matrix V k elements; Step S2.3.5, get the kth column of matrix U: u k =R(:,J k ) Step S2.3.6, calculate the 2-norm square of the approximate matrix: in, Represents vector u j The transpose of Step S2.3.7, determine whether the convergence error is satisfied: If Then the iteration ends, r = k; otherwise, the k+1th iteration begins; Step S3: Replace the weight matrix with the matrix U and matrix V obtained by matrix decomposition and compression for storage, thereby reducing the storage resource requirements for large language model deployment; Step S4: before fine-tuning the large language model based on LoRA, the rank r obtained in step S2 is set to the rank of the low-rank parameterized update matrix ΔW corresponding to the weight matrix W, and fine-tuning training is performed to obtain the matrix A and the matrix B, where ΔW = A·B; Step S5: Storing matrix A and matrix B as update matrices of the fine-tuned large language model; Step S6: When using the fine-tuned large language model for inference, for the input vector x, use the matrices compressed in step S2, matrix U and matrix V, and the updated matrices in step S5, matrix A and matrix B, to perform matrix-vector multiplication to complete the inference. The corresponding output h is: h=W·x+ΔW·x=U·V·x+A·B·x The computational complexity of the reasoning process is O(r(m+n)). By reducing the computational complexity of the reasoning process, the computing power threshold for using large language models is lowered.
2. The device for implementing the large language model acceleration method based on low-rank compression according to claim 1, characterized in that: It includes a matrix processing and storage module, a matrix compression and decomposition module, a model fine-tuning module and a model reasoning module; The matrix processing storage module is used to perform sparse explicit storage of weight matrix elements according to the format of row index number, column index number, element value, and skip the element whose element value is 0 or whose value is less than 1000 times of other element values and not store it; and store matrix U, matrix V, matrix A and matrix B; The matrix compression decomposition module is used to perform matrix compression decomposition on the weight matrix using an adaptive cross approximation algorithm according to the process in step S2, and decompose the weight matrix W with a dimension of m×n into two matrices U and V with dimensions of m×r and r×n respectively, where r is the rank of the weight matrix, and r<<min(m,n), that is, W=U·V; The model fine-tuning module is used to fine-tune the large language model based on LoRA, setting the rank r obtained in the matrix compression decomposition module to the rank of the low-rank parameterized update matrix ΔW corresponding to the weight matrix W, and performing fine-tuning training to obtain matrices A and B, where ΔW=A·B; The model inference module is used to complete the inference of the fine-tuned large language model. For the input vector x, the corresponding output h is: h=W·x+ΔW·x=U·V·x+A·B·x.
3. A large language model acceleration device based on low-rank compression, characterized in that: The method comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the method as claimed in claim 1 when executing the computer program.
4. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to claim 1 is implemented.
