Large language model inference acceleration method and related devices

By using an approximate model with fewer parameters but the same structure to generate a candidate output sequence, and evaluating it in parallel with the original target model, it solves the problem of memory access bandwidth during the inference process of large language models, improves the speed and efficiency of inference, and ensures the quality of the generated results.

CN118333172BActive Publication Date: 2024-09-03ZHONGHAO XINYING (HANGZHOU) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410751527.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-03
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

During the inference process of large-scale language models, the large parameter scale leads to memory access bandwidth problems, which limits the inference speed and performance. The decoding process is subject to the bottleneck of memory access bandwidth.

Method used

An approximate model with fewer model parameters but the same structure is used to generate candidate output sequences and evaluated in parallel in the original target model to improve computational efficiency and inference speed.

Benefits of technology

By reducing computing resource consumption and improving memory access efficiency, the inference speed of large language models is significantly accelerated, while ensuring the quality and accuracy of the generated sequences.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118333172B
    Figure CN118333172B
Patent Text Reader

Abstract

The embodiments of the present application provide a large-scale language model reasoning acceleration method and related devices. The method is applied to a model interaction network, which includes an original target model and a corresponding approximate model. The method includes: using an approximate model to generate a candidate output sequence; the model parameters of the approximate model are less than the original target model, and the approximate model and the original target model have the same model structure; multiple candidate output sequences are input into the original target model, and the candidate output sequences are evaluated in parallel to obtain the sequence evaluation results of each of the multiple candidate output sequences; based on the sequence evaluation results of each of the multiple candidate output sequences, the target output sequence of the final output is determined. The present application implements speculative sampling of the original target model by introducing an approximate model, improves memory access efficiency and memory access speed, so as to speed up the decoding process and achieve more efficient reasoning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data processing. More specifically, the embodiments of the present application relate to a large-scale language model reasoning acceleration method and related devices. Background Art

[0002] Large Language Model (LLM) can process and generate natural language and has powerful language understanding and generation capabilities.

[0003] At present, in the related art, due to the large scale of LLM parameters, problems such as memory access bandwidth are often faced during the inference process, which limits the inference speed and performance. During the decoding process, when generating each tag, all parameters need to be transferred from the storage unit to the computing unit. Due to the large scale of parameters, the need to frequently transmit parameters will result in a large amount of data transmission, increasing the burden of memory access bandwidth. In addition, in the autoregressive sampling algorithm, it is necessary to access the activation functions corresponding to all prefix positions, which will result in a large number of memory access operations and consume a large amount of memory access bandwidth. At the same time, due to the large amount of data accessed by the model, data needs to be read frequently from the memory during the decoding process, but the memory bandwidth is limited and cannot meet the high-speed data reading requirements, resulting in the decoding process being subject to the bottleneck of memory access bandwidth. In summary, the LLM decoding process is subject to memory access bandwidth due to multiple factors such as model parameter transmission, low memory access efficiency, and memory access bottleneck, which makes the memory access speed slow during the model inference process, affecting the decoding efficiency and model performance.

[0004] In summary, there is an urgent need to provide a new technical solution to solve at least one of the above-mentioned technical problems existing in the relevant technologies. Summary of the invention

[0005] In this context, the embodiments of the present application are intended to provide a large language model reasoning acceleration method and related devices to achieve speculative sampling of large language models, improve memory access efficiency and memory access speed, so as to speed up the decoding process and achieve more efficient reasoning.

[0006] In a first aspect of the embodiments of the present application, a large language model reasoning acceleration method is provided, which is applied to a model interaction network, wherein the model interaction network includes an original target model and a corresponding approximate model; the method includes:

[0007] Generate a candidate output sequence using the approximate model; the approximate model has fewer model parameters than the original target model, and the approximate model and the original target model have the same model structure;

[0008] Inputting the plurality of candidate output sequences into the original target model, and evaluating the candidate output sequences in parallel to obtain sequence evaluation results of the plurality of candidate output sequences;

[0009] Based on the sequence evaluation results of each of the plurality of candidate output sequences, a target output sequence for final output is determined.

[0010] In a second aspect of the embodiments of the present application, a large-scale language model reasoning acceleration device is provided, which is applied to a model interaction network, wherein the model interaction network includes an original target model and a corresponding approximate model; the device includes:

[0011] A generating module, configured to generate a candidate output sequence using an approximate model; the approximate model has fewer model parameters than the original target model, and the approximate model has the same model structure as the original target model;

[0012] An evaluation module, used for inputting the plurality of candidate output sequences into the original target model, and performing parallel evaluation on the candidate output sequences to obtain sequence evaluation results of the plurality of candidate output sequences;

[0013] The output module is used to determine a target output sequence for final output based on the sequence evaluation results of each of the plurality of candidate output sequences.

[0014] In a third aspect of the embodiments of the present application, a computing device is provided, the computing device comprising:

[0015] at least one processor, memory, and input-output unit;

[0016] The memory is used to store a computer program, and the processor is used to call the computer program stored in the memory to execute the large language model reasoning acceleration method of the first aspect.

[0017] In a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, which includes instructions. When the instructions are executed on a computer, the computer executes the large-scale language model reasoning acceleration method of the first aspect.

[0018] In the embodiment of the present application, a large language model reasoning acceleration method and related device are provided. In the embodiment of the present application, it is applied to a model interaction network, which includes an original target model and a corresponding approximate model. Here, the original target model is a large language model. First, the approximate model is used to generate a candidate output sequence. Among them, the model parameters of the approximate model are less than those of the original target model, and the approximate model and the original target model have the same model structure. In this way, by using an approximate model with fewer parameters, the computational cost and memory usage can be reduced compared to the original target model, and the decoding speed can be improved. At the same time, the approximate model and the original target model have the same model structure, which ensures that the generated candidate sequence is more consistent with the expected output of the original model and ensures the quality of the output sequence. Then, multiple candidate output sequences are input into the original target model, and the candidate output sequences are evaluated in parallel to obtain the sequence evaluation results of each of the multiple candidate output sequences. In this way, multiple candidate output sequences are simultaneously input into the original target model for evaluation, which realizes parallel processing, thereby improving the computational efficiency and accelerating the reasoning speed of the model, especially when processing a large number of sequences. The effect is more significant. Finally, based on the sequence evaluation results of each of the multiple candidate output sequences, the target output sequence of the final output is determined. In this way, by comprehensively analyzing the sequence evaluation results of multiple candidate output sequences, the optimal candidate output sequence is selected as the final output, ensuring the quality and accuracy of the generated results.

[0019] The implementation mode of the present application, by introducing an approximate model and a parallel evaluation method, realizes speculative sampling of the original target model, effectively improves the speed and efficiency of large-scale language model reasoning, reduces the consumption of computing resources, improves memory access efficiency and memory access speed, so as to speed up the decoding process and realize more efficient reasoning, while also effectively ensuring the quality of the generated sequence, ensuring the quality and accuracy of the generated results. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become readily understood. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, wherein:

[0021] Figure 1 A flowchart of a large language model reasoning acceleration method provided in one embodiment of the present application;

[0022] Figure 2 A schematic diagram of the principle of a large language model reasoning acceleration method provided in one embodiment of the present application;

[0023] Figure 3 A schematic diagram of the principle of a large language model reasoning acceleration example provided by another embodiment of the present application;

[0024] Figure 4 A schematic diagram of the structure of a large-scale language model reasoning acceleration device provided in one embodiment of the present application;

[0025] Figure 5 A schematic diagram of the structure of a medium in an embodiment of the present application is schematically shown;

[0026] Figure 6 A schematic diagram of the structure of a computing device according to an embodiment of the present application is shown schematically.

[0027] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION

[0028] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present application, and are not intended to limit the scope of the present application in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0029] Those skilled in the art know that the embodiments of the present application can be implemented as a system, device, equipment, method or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0030] Large Language Model (LLM) can process and generate natural language and has powerful language understanding and generation capabilities. LLM usually adopts structures such as autoregressive models (such as GPT) or autoencoder models (such as BERT), and learns the inherent laws and language patterns of text data through a large number of parameters and training data, thereby achieving natural language generation, translation, question answering and other tasks. LLM has been widely used in the field of natural language processing, and has achieved good results in tasks such as machine translation, text generation, and semantic understanding.

[0031] At present, in the related art, due to the large parameter scale of LLM, problems such as memory access bandwidth are often encountered during the inference process, which limits the inference speed and performance. During the decoding process, when each tag is generated, all parameters need to be transferred from the storage unit to the computing unit. For example, in the autoregressive sampling algorithm, the model needs to rely on the currently generated prefix sequence to generate the next token, and these prefix sequences are separated between the computing unit and the storage unit in the model. Therefore, each token needs to be transmitted once. Therefore, each time a token is generated, the current prefix sequence needs to be transmitted to the computing unit, and then the next token is calculated. This transmission process consumes a lot of storage access bandwidth, resulting in low inference efficiency. Among them, token refers to the basic unit in the language model, usually a word, a character or a subword. In natural language processing, the model generates corresponding tokens based on a given input sequence, that is, the corresponding words, characters or subwords.

[0032] In the related art, due to the large scale of parameters, the need to frequently transmit parameters will lead to a large amount of data transmission, which increases the burden of memory access bandwidth. In addition, in the autoregressive sampling algorithm, it is necessary to access the activation functions of all prefix corresponding positions, which will lead to a large number of memory access operations and consume a lot of memory access bandwidth. At the same time, due to the large amount of data accessed by the model, during the decoding process, it is necessary to frequently read data from the memory, but the memory bandwidth is limited and cannot meet the high-speed data reading requirements, resulting in the decoding process being subject to the bottleneck of memory access bandwidth.

[0033] Taking the autoregressive sampling algorithm as an example, the calculation process is usually divided into two steps: first, use the prefix as input, process the output result and normalize it into a probability distribution, and then sample to generate the next token. Secondly, concatenate the generated token and prefix into a new prefix, and repeat the first step until EOS (end of sentence sign) is generated or the maximum number of tokens is reached. In the first step, after the model outputs logits, it needs to be converted into a probability distribution. Common sampling methods include argmax, top-k, and top-n. Since autoregressive sampling only effectively calculates the part of the sequence length of 1 each time, but needs to access the activation functions corresponding to the positions of all prefixes, the calculation memory access ratio is very low. This makes the inference of large models subject to memory access speed, because generating each tag requires all parameters to be transferred from the storage unit to the computing unit, and the memory access bandwidth becomes a serious bottleneck.

[0034] In summary, the LLM decoding process is constrained by memory access bandwidth due to multiple factors such as model parameter transmission, low memory access efficiency, and memory access bottlenecks, which slows down memory access during model inference and affects decoding efficiency and model performance.

[0035] In summary, there is an urgent need to provide a new technical solution to solve at least one of the above-mentioned technical problems existing in the relevant technologies.

[0036] In order to overcome the above-mentioned technical problems existing in the existing solutions, according to the implementation mode of the present application, a large-scale language model reasoning acceleration method and related devices are proposed.

[0037] In the implementation mode of the present application, first, it is applied to a model interaction network, which includes an original target model and a corresponding approximate model. Here, the original target model is a large language model. First, the approximate model is used to generate a candidate output sequence. Among them, the model parameters of the approximate model are less than those of the original target model, and the approximate model has the same model structure as the original target model. In this way, by using an approximate model with fewer parameters, the computational cost and memory usage can be reduced compared to the original target model, and the decoding speed can be improved. At the same time, the approximate model has the same model structure as the original target model, which ensures that the generated candidate sequence is more consistent with the expected output of the original model and ensures the quality of the output sequence. Then, multiple candidate output sequences are input into the original target model, and the candidate output sequences are evaluated in parallel to obtain the sequence evaluation results of each of the multiple candidate output sequences. In this way, multiple candidate output sequences are simultaneously input into the original target model for evaluation, which realizes parallel processing, thereby improving the computational efficiency and speeding up the inference speed of the model, especially when processing a large number of sequences. The effect is more significant. Finally, based on the sequence evaluation results of each of the multiple candidate output sequences, the target output sequence of the final output is determined. In this way, by comprehensively analyzing the sequence evaluation results of multiple candidate output sequences, the optimal candidate output sequence is selected as the final output, ensuring the quality and accuracy of the generated results.

[0038] The implementation mode of the present application, by introducing an approximate model and a parallel evaluation method, realizes speculative sampling of the original target model, effectively improves the speed and efficiency of large-scale language model reasoning, reduces the consumption of computing resources, improves memory access efficiency and memory access speed, so as to speed up the decoding process and realize more efficient reasoning, while also effectively ensuring the quality of the generated sequence, ensuring the quality and accuracy of the generated results.

[0039] The technical solutions provided in the embodiments of the present application can be implemented by servers and / or terminal devices. It should be noted that the server involved in the embodiments of the present application can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, big data and artificial intelligence platforms.

[0040] The terminal device involved in the embodiments of the present application may be a device that provides voice and / or data connectivity to a user, a handheld device with a wireless connection function, or other processing devices connected to a wireless modem. For example, a mobile phone (or "cellular" phone) and a computer with a mobile terminal, for example, a portable, pocket-sized, handheld, computer-built-in or vehicle-mounted mobile device, which exchanges voice and / or data with a wireless access network. For example, Personal Communication Service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, Personal Digital Assistants (PDAs) and other devices.

[0041] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.

[0042] The principles and spirit of the present application are explained in detail below with reference to several representative implementations of the present application.

[0043] Reference below Figure 1 , Figure 1 A flowchart of a large language model reasoning acceleration method provided in an embodiment of the present application. A large language model reasoning acceleration method provided in an embodiment of the present application includes:

[0044] Step S101: Generate a candidate output sequence using the approximate model.

[0045] The technical solution provided in the embodiment of the present application is applied to a model interaction network. Specifically, the model interaction network includes an original target model and a corresponding approximate model. The approximate model is used to perform autoregressive serial sampling, and the original target model is used to evaluate the sampling results of the approximate model. It can be understood that autoregressive serial sampling refers to generating each token in a sequence one by one in order, usually by using the previously generated token as input to generate the next token. Evaluation sampling refers to using the original target model to evaluate the quality of the generated sequence to ensure that the generated sequence meets expectations, such as grammatical correctness, semantic coherence, etc. In this context embodiment, token refers to the basic unit in a large language model, for example, it can be a word, a character or a subword. In natural language processing, a large language model generates corresponding tokens, that is, corresponding words, characters or subwords, based on a given input sequence.

[0046] Exemplarily, the original target model can be a large language model, for example, composed of a deep neural network, which is used to generate natural language text, complete text classification, text generation and other tasks. The performance and accuracy of this model are high, but the computational complexity and memory consumption are also correspondingly large. The approximate model is a simplified version of the original target model with fewer model parameters, relatively low computational complexity and memory consumption. The approximate model has the same model structure as the original target model to ensure that the sequence it generates is more consistent with the output of the original target model. The introduction of the approximate model can improve the speed and efficiency of reasoning.

[0047] In step S101, the process of using the approximate model to generate candidate output sequences is to generate possible output sequences through the approximate model as the basis for further evaluation of the original target model. In this way, the computational burden can be reduced, the speed of generating output sequences can be accelerated, and a more efficient reasoning and decoding process can be achieved in subsequent steps.

[0048] In the embodiment of the present application, further optionally, the model parameters of the approximate model are less than the original target model. And, the approximate model has the same model structure as the original target model. Specifically, it is understandable that the number of model parameters of the approximate model is less than the number of model parameters of the original target model. This means that the amount of parameters that need to be stored in the approximate model is less, thereby reducing memory consumption and computational costs. By reducing the number of parameters, the reasoning process can be performed more efficiently. In addition, although the number of parameters of the approximate model is small, its model structure is the same as the original target model. This ensures that the approximate model can maintain output characteristics similar to the original model when generating candidate output sequences, thereby improving the quality and reliability of the candidate sequences. Through the above characteristics, the approximate model in the embodiment of the present application reduces the computational burden and improves the reasoning efficiency while maintaining output characteristics similar to the original target model, thereby achieving acceleration and optimization of the original target model.

[0049] In the embodiment of the present application, by using a model with fewer parameters but similar structure for actual sampling, the pressure of calculation and memory access can be reduced, thereby improving the reasoning speed. At the same time, the original target model is responsible for evaluating the quality of the sampling results to ensure that the generated sequence meets expectations. This dual-model interaction method is expected to make progress in solving the problem of slow reasoning speed of large language models. This dual-model interaction division method can make the entire sampling process more efficient. The autoregressive serial sampling used in the approximate model is used to generate sequences, which can gradually generate each token and maintain the continuity and logic of the generated sequence. The speculative evaluation sampling of the original target model ensures the quality of each sequence generated by the approximate model, because the original target model can provide a comprehensive evaluation of the generated sequence to ensure that it meets expectations such as grammar and semantics. Such a division makes full use of the advantages of the two models and improves the overall sampling efficiency and quality. Further, speculative evaluation sampling is a sampling method for generating models, whose goal is to generate the next token without relying on the generated token. Unlike the autoregressive model in the related art, speculative evaluation sampling does not require the previous token as input. It is usually used to generate longer sequences or when strict sequentiality is not required during generation. Compared to the autoregressive model, speculative evaluation sampling does not directly depend on previously generated tokens, and therefore has a more indirect relationship with them. However, the results of speculative sampling can still be evaluated by the evaluation model to ensure the quality of the generated sequence.

[0050] In summary, the use of an approximate model with fewer parameters but similar structure to replace the original target model for actual sampling in the embodiments of the present application can reduce the pressure of calculation and memory access, thereby improving the reasoning speed, because such an approximate model usually has a smaller model size and number of parameters. Smaller model size means less computing resource requirements and less memory access, because there are fewer parameters to be processed. This can reduce the computing and memory overhead, thereby speeding up the reasoning speed. The evaluation of the approximate model by the original target model further ensures the quality of the output results of the approximate model and ensures the accuracy of the model output sequence. The approximate model can quickly generate a token sequence, and the original target model can efficiently verify multiple tokens in parallel, thereby maximizing the computing throughput. The method in the embodiment of the present application can take into account both speed and accuracy when generating a sequence, thereby improving the overall efficiency of the model.

[0051] In step S101, further optionally, the approximate model is used to generate a candidate output sequence, which can be implemented as follows:

[0052] Step S1011, initializing and setting an initialization token value, and inputting the initialization token value into the approximate model to obtain a first initial token sample;

[0053] Step S1012, inputting the first initial token sample into the approximate model to predict a second initial token sample;

[0054] Step S1013, cyclically inputting multiple initial token samples into the approximate model until a preset number of initial token samples are obtained, and constructing a corresponding candidate output sequence with the preset number of initial token samples.

[0055] Specifically, in step S1011, the initialization token value is initialized and set, and the initialization token value is input into the approximate model to obtain the first initial token sample. This step is intended to provide a starting point for the start of generating a sequence, and the first initial token sample is obtained by inputting the initialization token value into the approximate model. In step S1012, the first initial token sample is input into the approximate model to predict the second initial token sample. In this step, the first initial token sample is used as input, and the second initial token sample is generated through the reasoning process of the approximate model to gradually expand the sequence. In step S1013, multiple initial token samples are input into the approximate model in a loop until a preset number of initial token samples are obtained, and the corresponding candidate output sequence is constructed with the preset number of initial token samples. The initial token samples are generated by continuously looping, and the length of the sequence is gradually extended until the preset number is reached to construct a complete candidate output sequence.

[0056] The purpose of these steps is to gradually generate candidate output sequences through the approximate model to provide to the original target model for further evaluation and selection. By gradually generating sequences, the computational burden can be effectively reduced and the generation process can be accelerated while ensuring the quality of the sequence.

[0057] Step S102: input multiple candidate output sequences into the original target model, and evaluate the candidate output sequences in parallel to obtain sequence evaluation results of each of the multiple candidate output sequences.

[0058] It can be understood that parallel evaluation refers to batch-feeding multiple candidate output sequences into the original target model so that these candidate output sequences can be evaluated at the same time. This parallel processing can significantly improve the efficiency of evaluation, especially when processing a large number of candidate sequences, assuming that the original target model is a deep learning model for task solving, such as a language model or a machine translation model. Through parallel evaluation, the evaluation results of each candidate sequence can be obtained faster, thereby accelerating the decision-making process of the model.

[0059] From the perspective of technical effects, evaluating multiple candidate sequences at the same time can process more sequences in the same time, thereby speeding up the entire processing process and improving the model's computational efficiency. Through parallel processing, the evaluation time of each sequence can be reduced, thereby reducing the latency of system response. Parallel evaluation enables the system to easily process a large number of candidate sequences without performance degradation due to an increase in the number of sequences. In summary, parallel evaluation technology can effectively improve the efficiency and performance of sequence generation tasks, allowing the model to generate high-quality output sequences more quickly.

[0060] Specifically, an optional embodiment of step S102 is shown in Figure 2 As shown, it can be implemented as follows:

[0061] Step S201: input a plurality of the candidate output sequences into the original target model.

[0062] Step S202: Perform sample reasoning and parallel evaluation on the plurality of candidate output sequences through the original target model to obtain sample reasoning and evaluation results of the plurality of candidate output sequences.

[0063] Wherein, the candidate output sequence is composed of multiple initial token samples. That is, the candidate output sequence is composed of multiple initial token samples, which means that the starting position of the sequence is not a single token, but is composed of multiple initial tokens. For example, in some sequence generation tasks, the model may need to consider multiple different starting points at the same time. At this time, multiple initial token samples can be used to represent these different starting positions. For example, if you want to generate the text of a dialogue, you may consider the speeches of two different characters at the same time, then the starting position of each character's speech can be represented by an initial token sample.

[0064] The sample reasoning evaluation result is used to indicate whether each candidate output sequence meets the preset condition. Further optionally, in an embodiment of the present application, the preset condition at least includes: the total number of initial token samples in the candidate output sequence that meet the model reasoning condition reaches a preset minimum target sequence length.

[0065] For example, suppose there are two candidate output sequences: an English sentence: "How are you?", corresponding to the initial token samples that meet the model reasoning conditions: ["How", "are"]. Another English sentence: "What is your name?", corresponding to the initial token samples that meet the model reasoning conditions: ["What", "is", "your"]. Further assume that the preset condition is that the total number of initial token samples that meet the model reasoning conditions in the candidate output sequence must reach 3, that is, the preset minimum target sequence length. For the first candidate output sequence, the total number of initial token samples is 2, which does not meet the preset condition, so the sample reasoning evaluation result will indicate that the sequence does not meet the preset condition. For the second candidate output sequence, the total number of initial token samples is 3, which meets the preset condition, so the sample reasoning evaluation result will indicate that the sequence has met the preset condition. In this way, through the sample reasoning evaluation results, it is possible to determine which candidate output sequences meet the preset conditions, and then make subsequent decisions or choices.

[0066] Through the above steps S201 to S202, a process of inputting multiple candidate output sequences into the original target model and performing sample reasoning and parallel evaluation through the model is realized. In this process, multiple candidate output sequences can be simultaneously input into the original target model for evaluation through parallel processing, thereby realizing efficient processing of multiple candidate sequences and improving processing efficiency. By performing sample reasoning and parallel evaluation on the original target model, the quality of each candidate output sequence can be more accurately evaluated, which helps to select the best output sequence, so that the accuracy of the model is further improved. After obtaining the sample reasoning and evaluation results of each of the multiple candidate output sequences, a decision can be made quickly to select the most appropriate sequence as the final output, which speeds up the entire prediction process. In summary, through these steps, the candidate output sequences can be effectively evaluated and selected, which improves the generation efficiency and output quality of the model.

[0067] Further optionally, in step S202, sample reasoning and parallel evaluation are performed on the plurality of candidate output sequences through the original target model to obtain sample reasoning and evaluation results of the plurality of candidate output sequences respectively, which can be implemented as the following steps:

[0068] Step S2021, predicting the probability prediction distribution corresponding to each initial token sample in the candidate output sequence through the original target model;

[0069] Step S2022: if the first initial token sample in the candidate output sequence is consistent with the corresponding probability prediction value in the probability prediction distribution, it is determined that the first initial token sample meets the model reasoning condition, and jumps to the next initial token sample;

[0070] Step S2023: If the second initial token sample in the candidate output sequence is inconsistent with the corresponding probability prediction value in the probability prediction distribution, it is determined that the second initial token sample does not meet the model inference condition.

[0071] Specifically, in step S202, performing sample reasoning and parallel evaluation on multiple candidate output sequences through the original target model can be further refined into the following steps. In step S2021, the probability prediction distribution corresponding to each initial token sample in the candidate output sequence is predicted through the original target model. This means that the model will give the possibility distribution of each initial token, that is, the probability of each token in the sequence. In step S2022, if the first initial token sample in the candidate output sequence is consistent with the corresponding probability prediction value in the probability prediction distribution, then it is determined that the first initial token sample meets the model reasoning condition and jumps to the next initial token. This means that if the probability predicted by the model is consistent with the first token in the actual sequence, then the token meets the model reasoning condition. In step S2023, if the second initial token sample in the candidate output sequence is inconsistent with the corresponding probability prediction value in the probability prediction distribution, then it is determined that the second initial token sample does not meet the model reasoning condition. This means that if the probability predicted by the model does not match the second token in the actual sequence, then the token does not meet the model reasoning condition. Through these steps, it is possible to determine whether each initial token sample meets the model reasoning conditions based on the model's probability prediction distribution, thereby performing sample reasoning and parallel evaluation.

[0072] Step S103: determining a target output sequence for final output based on the sequence evaluation results of each of the plurality of candidate output sequences.

[0073] Based on the above optional embodiment, in step S103, based on the sequence evaluation results of each of the multiple candidate output sequences, an optional embodiment of determining the target output sequence for the final output is shown in FIG. Figure 2 As shown, it can be implemented as follows:

[0074] Step S203, reconstructing the initial token samples in the candidate output sequence that do not meet the model reasoning conditions;

[0075] Step S204: until the sample reasoning evaluation result indicates that the candidate output sequence meets the preset condition, the candidate output sequence is output as the target output sequence.

[0076] In step S203, the initial token samples in the candidate output sequence that do not meet the model reasoning conditions are reconstructed, which means that the token samples that do not meet the conditions need to be corrected or replaced so that the entire candidate output sequence meets the model reasoning conditions. In step S204, until the sample reasoning evaluation result indicates that the candidate output sequence meets the preset conditions, the candidate output sequence is output as the target output sequence. This means that only when all the initial token samples meet the model reasoning conditions, the entire candidate output sequence will be deemed to meet the preset conditions and finally output as the target output sequence.

[0077] For example, suppose there is a task of automatically generating an image title, the candidate output sequence is different parts of the image title, and the initial token samples are different features or keywords of the image. Assume that the candidate output sequence is "A happyfamily enjoying a picnic in the park"; assume that the initial token samples are ["A", "happy", "family", "enjoying", "a", "picnic", "in", "the", "park"]. Based on the above assumptions, in step S203, if it is found that the token "family" does not meet the model reasoning conditions, it may be adjusted to a suitable token according to the context, such as replacing it with "children". Then, after sample reasoning and parallel evaluation, each token is checked step by step until all tokens meet the model reasoning conditions. When all the initial token samples meet the model reasoning conditions after correction, the entire candidate output sequence will be determined to meet the preset conditions and output as the final target output sequence, that is, "Bring a happy day for the family to enjoy a picnic". In this way, the reconstruction and optimization of the candidate output sequence is achieved, ensuring that the generated image title is of high quality and meets expectations.

[0078] Further optionally, in step S203, the initial token samples in the candidate output sequence that do not meet the model reasoning condition are reconstructed, which can be implemented as follows:

[0079] Step S2031, performing a discard operation on the second initial token sample in the candidate output sequence, and performing a forward transfer process on the candidate output sequence;

[0080] Step S2032: resample the approximate model to obtain a third initial token sample to replace the discarded second initial token sample in the candidate output sequence.

[0081] Specifically, in step S203, the reconstruction of the initial token samples in the candidate output sequence that do not meet the model reasoning conditions can be further refined into the following steps. In step S2031, the second initial token sample in the candidate output sequence is discarded, and the candidate output sequence is forward-passed. This means that the second token that does not meet the conditions is removed from the sequence, and the remaining sequence is reprocessed to ensure that subsequent tokens meet the model reasoning conditions. In step S2032, the approximate model is resampled to obtain a third initial token sample to replace the discarded second initial token sample. This means that a new token sample is obtained from the approximate model to replace the removed token in the original sequence, thereby maintaining the integrity and rationality of the sequence. Through these steps, the initial token samples that do not meet the model reasoning conditions can be effectively reconstructed, so that the candidate output sequence meets the preset conditions, and finally generates a high-quality target output sequence.

[0082] In practical applications, further optionally, the probability prediction distribution corresponding to each initial token sample in the candidate output sequence is predicted by the original target model, which can be implemented as follows:

[0083] Through the original target model q, calculate the nth initial token sample in the candidate output sequence output by the approximate model p Corresponding probability prediction distribution; wherein, A probability prediction distribution includes at least: , ,…… .

[0084] Optionally, the nth initial token sample in the candidate output sequence output by the approximate model p is calculated through the original target model q Corresponding After the probability prediction distribution, it can also be implemented as follows:

[0085] If the original target model q is about The probability prediction distribution value of Greater than the approximate model p with respect to the sampled value The probability prediction distribution value of , then determine that the nth initial token sample in the candidate output sequence is consistent with the corresponding probability prediction value in the probability prediction distribution. If the original target model q is about the sample value The probability prediction distribution value of Less than the approximate model p about The probability prediction distribution value of , it is determined that the nth initial token sample in the candidate output sequence is inconsistent with the corresponding probability prediction value in the probability prediction distribution.

[0086] In the above steps, the original target model q is first used to calculate the probability prediction distribution corresponding to the nth initial token sample in the candidate output sequence output by the approximate model p. This probability prediction distribution reflects the model's estimate of the possibility of each token in the sequence. Then, according to the calculated probability prediction distribution. If the probability prediction distribution value of the original target model q about is greater than the probability prediction distribution value of the approximate model p about the sampling value, it is determined that the nth initial token sample in the candidate output sequence is consistent with the corresponding probability prediction value in the probability prediction distribution. If the probability prediction distribution value of the original target model q about the sampling value is less than the probability prediction distribution value of the approximate model p about, it is determined that the nth initial token sample in the candidate output sequence is inconsistent with the corresponding probability prediction value in the probability prediction distribution. In this way, it is possible to determine whether the nth initial token sample meets the model reasoning condition based on the probability prediction distribution of the two models, thereby optimizing and reconstructing the candidate output sequence. Thus, by comparing the probability prediction distributions of the original target model and the approximate model, it is possible to more accurately determine whether each initial token sample in the candidate output sequence meets the model reasoning condition, thereby improving the accuracy and rationality of the model generation sequence.

[0087] As an alternative example, in Figure 3In , each row represents an iteration. The green marks are candidate tokens output by the approximate model, and the target model determines whether to accept the suggestions generated by these candidate tokens. The red and blue marks represent rejection and correction, respectively. Then, using the speculative sampling method, the approximate model generates 5 tokens in the first row. The original target model uses these 5 tokens and the sentence "[START] japan's bechmarkbond" concatenated with the prefix as input, and verifies the generation effect of the small model (i.e., the approximate model) through one inference execution. The latter token "bond" is rejected by the original target model and resampled to generate "n". In this way, the four tokens in the middle, "japan", "'", "s", and "benchmark", are all generated by the small model (i.e., the approximate model). Since the large model (i.e., the target model) executes the input sequence in parallel, the large model (i.e., the target model) only passes forward 9 times and generates 37 tokens. Although the total computational complexity of the large model (i.e., the target original model) remains unchanged, the delay of inferring one token and five tokens by the large model (i.e., the target original model) is similar. Therefore, compared with the computational speed of generating words one by one through the large model, the computational speed of the technical solution provided in the embodiment of the present application is faster.

[0088] In the implementation mode of the present application, through the above steps S101 to S103, by introducing an approximate model and a parallel evaluation method, speculative sampling of the original target model is achieved, which effectively improves the speed and efficiency of large-scale language model reasoning, reduces the consumption of computing resources, and improves memory access efficiency and memory access speed to speed up the decoding process and achieve more efficient reasoning. At the same time, it also effectively guarantees the quality of the generated sequence and ensures the quality and accuracy of the generated results.

[0089] After introducing the method of the exemplary embodiment of the present application, next, refer to Figure 4 A large-scale language model reasoning acceleration device according to an exemplary embodiment of the present application is described. The device is applied to a model interaction network, which includes an original target model and a corresponding approximate model. The device includes the following modules:

[0090] A generating module, configured to generate a candidate output sequence using the approximate model; the approximate model has fewer model parameters than the original target model, and the approximate model and the original target model have the same model structure;

[0091] An evaluation module, used for inputting the plurality of candidate output sequences into the original target model, and performing parallel evaluation on the candidate output sequences to obtain sequence evaluation results of the plurality of candidate output sequences;

[0092] The output module is used to determine a target output sequence for final output based on the sequence evaluation results of each of the plurality of candidate output sequences.

[0093] As an optional implementation manner, the evaluation module, when inputting the plurality of candidate output sequences into the original target model and evaluating the candidate output sequences in parallel to obtain respective sequence evaluation results of the plurality of candidate output sequences, is specifically used to:

[0094] Inputting a plurality of the candidate output sequences into the original target model; the candidate output sequences are composed of a plurality of initial token samples;

[0095] By using the original target model, performing sample reasoning and parallel evaluation on the plurality of candidate output sequences to obtain sample reasoning and evaluation results of the plurality of candidate output sequences;

[0096] The sample reasoning evaluation result is used to indicate whether each of the candidate output sequences meets a preset condition.

[0097] As an optional implementation, the output module, when determining the target output sequence of the final output based on the sequence evaluation results of each of the plurality of candidate output sequences, is specifically configured to:

[0098] Reconstructing the initial token samples in the candidate output sequence that do not meet the model reasoning conditions;

[0099] Until the sample reasoning evaluation result indicates that the candidate output sequence meets the preset condition, the candidate output sequence is output as the target output sequence.

[0100] As an optional implementation, the preset condition at least includes: the total number of initial token samples in the candidate output sequence that meet the model inference condition reaches a preset minimum target sequence length.

[0101] As an optional implementation, the evaluation module performs sample reasoning and parallel evaluation on the plurality of candidate output sequences through the original target model to obtain sample reasoning and evaluation results of each of the plurality of candidate output sequences, specifically for:

[0102] Predicting the probability prediction distribution corresponding to each initial token sample in the candidate output sequence through the original target model;

[0103] If the first initial token sample in the candidate output sequence is consistent with the corresponding probability prediction value in the probability prediction distribution, it is determined that the first initial token sample meets the model reasoning condition, and jumps to the next initial token sample;

[0104] If the second initial token sample in the candidate output sequence is inconsistent with the corresponding probability prediction value in the probability prediction distribution, it is determined that the second initial token sample does not meet the model inference condition.

[0105] As an optional implementation, the output module, when reconstructing the initial token sample in the candidate output sequence that does not meet the model reasoning condition, is specifically used to:

[0106] Performing a discard operation on the second initial token sample in the candidate output sequence, and performing a forward transfer process on the candidate output sequence;

[0107] The approximate model is resampled to obtain a third initial token sample to replace the discarded second initial token sample in the candidate output sequence.

[0108] As an optional implementation, the evaluation module, when predicting the probability prediction distribution corresponding to each initial token sample in the candidate output sequence through the original target model, is specifically used to:

[0109] Through the original target model q, calculate the nth initial token sample in the candidate output sequence output by the approximate model p Corresponding probability prediction distribution; wherein, A probability prediction distribution includes at least: , ,…… .

[0110] The evaluation module calculates the nth initial token sample in the candidate output sequence output by the approximate model p through the original target model q Corresponding After the probability prediction distribution, it is also used specifically for:

[0111] If the original target model q is about The probability prediction distribution value of Greater than the approximate model p with respect to the sampled value The probability prediction distribution value of , it is determined that the nth initial token sample in the candidate output sequence is consistent with the corresponding probability prediction value in the probability prediction distribution;

[0112] If the original target model q is about The probability prediction distribution value of Less than the approximate model p with respect to the sampled value The probability prediction distribution value of , it is determined that the nth initial token sample in the candidate output sequence is inconsistent with the corresponding probability prediction value in the probability prediction distribution.

[0113] As an optional implementation, the generation module uses the approximate model to generate a candidate output sequence, specifically for:

[0114] Initialize and set an initial token value, and input the initial token value into the approximate model to obtain a first initial token sample;

[0115] Inputting the first initial token sample into the approximate model to predict a second initial token sample;

[0116] Multiple initial token samples are cyclically input into the approximate model until a preset number of initial token samples are obtained, and the preset number of initial token samples are used to construct a corresponding candidate output sequence.

[0117] In the embodiment of the present application, through a large language model reasoning acceleration device, by introducing an approximate model and a parallel evaluation method, speculative sampling of the original target model is achieved, which effectively improves the speed and efficiency of large language model reasoning, reduces the consumption of computing resources, and improves memory access efficiency and memory access speed to speed up the decoding process and achieve more efficient reasoning. At the same time, it also effectively guarantees the quality of the generated sequence and ensures the quality and accuracy of the generated results.

[0118] After introducing the devices, methods and apparatus of the exemplary embodiments of the present application, next, reference is made to Figure 5 The computer-readable storage medium of the exemplary embodiment of the present application is described. The computer-readable storage medium can be set in a large language model reasoning acceleration device. Please refer to Figure 5 , the computer-readable storage medium shown is a CD 110, on which a computer program (i.e., a program product) is stored. When the computer program is executed by the processor, the steps described in the above method implementation are implemented, for example, the approximate model is used to generate a candidate output sequence; the model parameters of the approximate model are less than those of the original target model, and the approximate model and the original target model have the same model structure; a plurality of the candidate output sequences are input into the original target model, and the candidate output sequences are evaluated in parallel to obtain sequence evaluation results of each of the plurality of candidate output sequences; based on the sequence evaluation results of each of the plurality of candidate output sequences, the target output sequence of the final output is determined; the specific implementation method of each step is not repeated here.

[0119] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0120] After introducing the devices, methods, media and apparatus of the exemplary embodiments of the present application, reference is now made to Figure 6 For the computing device for large-scale language model reasoning acceleration according to the exemplary embodiment of the present application, the computing device can be set in a large-scale language model reasoning acceleration device.

[0121] Figure 6 A block diagram of an exemplary computing device 120 suitable for implementing embodiments of the present application is shown. The computing device 120 may be a computer system or a server. Figure 6 The computing device 120 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0122] like Figure 6 As shown, the components of the computing device 120 may include, but are not limited to: one or more processors or processing units 1201 , a system memory 1202 , and a bus 1203 connecting different system components (including the system memory 1202 and the processing unit 1201 ).

[0123] The computing device 120 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computing device 120, including volatile and nonvolatile media, removable and non-removable media.

[0124] System memory 1202 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 12021 and / or cache memory 12022. Computing device 120 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, ROM 12023 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 is not shown in the Figure 6As shown in the figure, a disk drive for reading and writing a removable non-volatile disk (such as a "floppy disk") and an optical disk drive for reading and writing a removable non-volatile optical disk (such as a CD-ROM, DVD-ROM or other optical media) can be provided. In these cases, each drive can be connected to the bus 1203 through one or more data medium interfaces. The system memory 1202 may include at least one program product, which has a set (such as at least one) of program modules, which are configured to perform the functions of each embodiment of the present application.

[0125] A program / utility 12025 having a set (at least one) of program modules 12024 may be stored, for example, in system memory 1202, and such program modules 12024 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 12024 generally perform the functions and / or methods of the embodiments described herein.

[0126] The computing device 120 may also communicate with one or more external devices 1204 (e.g., a keyboard, a pointing device, a display, etc.). Such communication may be performed via an input / output (I / O) interface 605. In addition, the computing device 120 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 1206. Figure 6 As shown, the network adapter 1206 communicates with other modules (such as the processing unit 1201, etc.) of the computing device 120 via the bus 1203. It should be understood that although Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with computing device 120 .

[0127] The processing unit 1201 executes various functional applications and data processing by running the program stored in the system memory 1202, for example, using the approximate model to generate a candidate output sequence; the model parameters of the approximate model are less than the original target model, and the approximate model has the same model structure as the original target model; multiple candidate output sequences are input into the original target model, and the candidate output sequences are evaluated in parallel to obtain the sequence evaluation results of each of the multiple candidate output sequences; based on the sequence evaluation results of each of the multiple candidate output sequences, the target output sequence of the final output is determined. The specific implementation of each step is not repeated here. It should be noted that although several units / modules or sub-units / sub-modules of the large language model reasoning acceleration device are mentioned in the above detailed description, this division is only exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units / modules described above can be concretized in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be concretized.

[0128] In the description of the present application, it should be noted that the terms "first", "second" and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0129] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0130] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0131] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0132] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0133] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0134] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

[0135] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

Claims

1. A method for accelerating reasoning of a large language model, characterized in that: Applied to a model interaction network, the model interaction network includes an original target model and a corresponding approximate model; the method includes: Generate a candidate output sequence using the approximate model; the approximate model has fewer model parameters than the original target model, and the approximate model and the original target model have the same model structure; Inputting the plurality of candidate output sequences into the original target model, and evaluating the candidate output sequences in parallel to obtain sequence evaluation results of the plurality of candidate output sequences; Determining a target output sequence for final output based on the sequence evaluation results of each of the plurality of candidate output sequences; The step of inputting the plurality of candidate output sequences into the original target model and evaluating the candidate output sequences in parallel to obtain respective sequence evaluation results of the plurality of candidate output sequences includes: Inputting a plurality of the candidate output sequences into the original target model; the candidate output sequences are composed of a plurality of initial token samples; By using the original target model, performing sample reasoning and parallel evaluation on the plurality of candidate output sequences to obtain sample reasoning and evaluation results of the plurality of candidate output sequences; The sample reasoning evaluation result is used to indicate whether each of the candidate output sequences meets a preset condition.

2. The method for accelerating the reasoning of a large language model according to claim 1, characterized in that: The step of determining a target output sequence for final output based on respective sequence evaluation results of the plurality of candidate output sequences comprises: Reconstructing the initial token samples in the candidate output sequence that do not meet the model reasoning conditions; Until the sample reasoning evaluation result indicates that the candidate output sequence meets the preset condition, the candidate output sequence is output as the target output sequence.

3. The method for accelerating the reasoning of a large language model according to claim 2, characterized in that: The preset condition at least includes: the total number of initial token samples in the candidate output sequence that meet the model inference condition reaches a preset minimum target sequence length.

4. The method for accelerating the reasoning of a large language model according to claim 3, characterized in that: The performing sample reasoning and parallel evaluation on the plurality of candidate output sequences through the original target model to obtain sample reasoning and evaluation results of each of the plurality of candidate output sequences includes: Predicting the probability prediction distribution corresponding to each initial token sample in the candidate output sequence through the original target model; If the first initial token sample in the candidate output sequence is consistent with the corresponding probability prediction value in the probability prediction distribution, it is determined that the first initial token sample meets the model reasoning condition, and jumps to the next initial token sample; If the second initial token sample in the candidate output sequence is inconsistent with the corresponding probability prediction value in the probability prediction distribution, it is determined that the second initial token sample does not meet the model inference condition.

5. The method for accelerating the reasoning of a large language model according to claim 4, characterized in that: The reconstructing the initial token samples in the candidate output sequence that do not meet the model reasoning condition includes: Performing a discard operation on the second initial token sample in the candidate output sequence, and performing a forward transfer process on the candidate output sequence; The approximate model is resampled to obtain a third initial token sample to replace the discarded second initial token sample in the candidate output sequence.

6. The method for accelerating the reasoning of a large language model according to claim 1, characterized in that: The step of using the approximate model to generate a candidate output sequence comprises: Initialize and set an initial token value, and input the initial token value into the approximate model to obtain a first initial token sample; Inputting the first initial token sample into the approximate model to predict a second initial token sample; Multiple initial token samples are cyclically input into the approximate model until a preset number of initial token samples are obtained, and the preset number of initial token samples are used to construct a corresponding candidate output sequence.

7. A large-scale language model reasoning acceleration device, characterized in that: The device is applied to a model interaction network, wherein the model interaction network includes an original target model and a corresponding approximate model; the device includes: A generating module, configured to generate a candidate output sequence using the approximate model; the approximate model has fewer model parameters than the original target model, and the approximate model and the original target model have the same model structure; An evaluation module, used for inputting the plurality of candidate output sequences into the original target model, and performing parallel evaluation on the candidate output sequences to obtain sequence evaluation results of the plurality of candidate output sequences; An output module, used to determine a target output sequence for final output based on the sequence evaluation results of each of the plurality of candidate output sequences; Among them, the evaluation module, when inputting multiple candidate output sequences into the original target model and performing parallel evaluation on the candidate output sequences to obtain sequence evaluation results of each of the multiple candidate output sequences, is specifically used to: input multiple candidate output sequences into the original target model; the candidate output sequence consists of multiple initial token samples; through the original target model, perform sample reasoning and parallel evaluation on the multiple candidate output sequences to obtain sample reasoning and evaluation results of each of the multiple candidate output sequences; the sample reasoning and evaluation results are used to indicate whether each of the candidate output sequences meets the preset conditions.

8. A computing device, characterized in that The computing device comprises: at least one processor, memory, and input-output unit; The memory is used to store a computer program, and the processor is used to call the computer program stored in the memory to execute the reasoning acceleration method for a large language model as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The method comprises instructions which, when executed on a computer, cause the computer to execute the method for accelerating the reasoning of a large language model as claimed in any one of claims 1 to 6.