Memory-efficient speculative decoding in generative artificial intelligence models
By using a draft model with adapters to approximate a target model, the memory and computational demands of generative AI models are reduced, allowing efficient response generation on resource-constrained devices.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2026-03-12
AI Technical Summary
Generative artificial intelligence models, such as large language models, are computationally expensive and memory-intensive, making them impractical for deployment on devices with limited resources, and speculative decoding techniques with draft models increase computational and memory demands.
Implement a draft model as a subset of layers from a target model, associated with adapters to approximate the target model's behavior, reducing memory footprint and computational resources by using speculative sampling.
This approach reduces the memory footprint and computational expense, enabling efficient response generation on devices with limited resources, such as smartphones and IoT devices, by accelerating token generation and reducing memory overhead.
Smart Images

Figure CN2024117334_12032026_PF_FP_ABST
Abstract
Description
MEMORY-EFFICIENT SPECULATIVE DECODING IN GENERATIVE ARTIFICIAL INTELLIGENCE MODELS
[0001] INTRODUCTION
[0002] Aspects of the present disclosure relate to generative artificial intelligence models, and more specifically to speculative decoding in generative artificial intelligence models (also referred to as “generative models” ) .
[0003] Generative artificial intelligence models can be used in various environments in order to generate a response to an input prompt (also referred to as a query or an input) . For example, generative artificial intelligence models can be used in chatbot applications in which large language models (LLMs) are used to generate an answer, or at least a response, to an input prompt. Other examples in which generative artificial intelligence models can be used include a latent diffusion model, in which a model generates an image from an input text description of the content of the desired image, decision transformers, in which future actions are predicted based on sequences of prior actions within a given environment, or the like.
[0004] Generally, generating a response to a query using generative artificial intelligence models may be computationally expensive. For example, in a chatbot deployment in which a large language model is used to generate a response to a query formatted as a text query, a response to the query may be generated using a pass through the large language model for each token (e.g., a word or part of a word) generated as part of the response. The output of each pass may be a probability distribution on a set of tokens (e.g., words or parts of words) from which the next token (e.g., a word or part of a word) may be selected, for example, by sampling or based on maximum likelihood. Because a pass through a large language model is used to generate each word (or token (s) ) in a response to a query, the computational expense may be modeled as the product of the number of words included in the response and the computational resource expense (e.g., in terms of processing power, memory bandwidth, and / or other compute resources used) of performing a pass through the large language model, which generally increases as the number of parameters within the large language model increases.
[0005] BRIEF SUMMARY
[0006] Certain aspects of the present disclosure provide a method for generating a response to an input prompt using a generative artificial intelligence model. The method generally includes receiving an input prompt for processing. A response to the input prompt is generated using a first generative artificial intelligence model. Generally, the first generative artificial intelligence model comprising a subset of layers of a second generative artificial intelligence model and one or more adapters associated with the subset of layers of the second generative artificial intelligence model. The generated response to the input prompt is output.
[0007] Other aspects provide processing systems configured to perform the aforementioned methods as well as those described herein; non-transitory, computer-readable media comprising instructions that, when executed by one or more processors of a processing system, cause the processing system to perform the aforementioned methods as well as those described herein; a computer program product embodied on a computer-readable storage medium comprising code for performing the aforementioned methods as well as those further described herein; and a processing system comprising means for performing the aforementioned methods as well as those further described herein.
[0008] The following description and the related drawings set forth in detail certain illustrative features of one or more aspects.BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The appended figures depict only certain aspects of this disclosure and are therefore not to be considered limiting of the scope of this disclosure.
[0010] FIG. 1 illustrates an example pipeline for efficient response generation using generative artificial intelligence models, according to certain aspects of the present disclosure.
[0011] FIG. 2 illustrates an example of efficient multi-token speculative sampling in generative artificial intelligence models, according to certain aspects of the present disclosure.
[0012] FIG. 3 illustrates example operations for generating a response to an input prompt using speculative sampling in generative artificial intelligence models, according to certain aspects of the present disclosure.
[0013] FIG. 4 depicts an example processing system configured to perform various aspects of the present disclosure.
[0014] To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the drawings. It is contemplated that elements and features of one aspect may be beneficially incorporated in other aspects without further recitation.DETAILED DESCRIPTION
[0015] Aspects of the present disclosure provide apparatus, methods, processing systems, and computer-readable mediums for efficiently generating responses to input queries using generative artificial intelligence models.
[0016] Generally, generative artificial intelligence models generate a response to a query input into the model. For example, a large language model (LLM) deployed within a chatbot can generate a response to a query using multiple passes through the large language model, with each successive pass being based on the query (which may be tokenized for processing) and the tokens (or words) generated using previous passes through the large language model. Generally, these large language models may include a large number (e.g., billions, or even trillions) of weights or parameters within the model. Because of the size of these models and the operations performed on each token to predict what should be the next token generated in response to a query and the previously generated tokens, it may not be practical, or even possible, to deploy large language models on a variety of devices which have limited memory, storage, and / or processing capabilities relative to cloud compute instances on which large language models typically operate. Further, in some cases, the memory bandwidth involved in generating a response to a query provided as input into a model may prevent compute resources from being used for other tasks.
[0017] To improve the efficiency and throughput of large language models, speculative decoding techniques allow for a smaller language model, sometimes known as a draft large language model (or as a draft model or an approximation model) , to execute (e.g., sequentially or in parallel) with a larger language model, sometimes known as a target large language model (or as a target model) . In such a case, the draft model can generate speculatively additional tokens in sequence and probabilities used for sampling these additional tokens based on a current set of accepted tokens. The target model can generate tokens based on the tokens generated by the draft model. To generate a result, the target model can perform rejection sampling on a per-token basis to accept or reject individual tokens generated by the draft model such that the draft model and the target model have similar probability distributions.
[0018] In some aspects, the draft model may be a pruned version of the target model chosen such that the draft model and target model have similar probability distributions. In other aspects, the draft model may be a smaller version of the target model (e.g., trained on millions of tokens, instead of hundreds of millions or even billions of tokens) .
[0019] Certain aspects of the present disclosure provide techniques and apparatus for efficiently generating responses to a query input into a generative artificial intelligence model (e.g., a large language model) using speculative sampling. Generally, to allow for efficient inferencing and response generation, a draft model may be defined as a subset of layers from a target model (e.g., a truncated version of the target model) , and each layer in the subset of layers may be associated with an adapter that is configured to cause the draft model to approximate the behavior of the target model. By doing so, aspects of the present disclosure may reduce the memory footprint of generative artificial intelligence models used in speculative decoding. The reduction in the memory footprint of generative artificial intelligence models used in speculative decoding may correspond to a reduction in a number of parameters used by the draft model during inferencing, which may reduce the amount of computation performed during inferencing and correspondingly accelerate the rate at which tokens are generated by a generative artificial intelligence model relative to techniques in which additional inferencing heads are introduced into a model for draft model token generation. In turn, the acceleration of the rate at which tokens are generated may reduce the amount of time, processing resources, memory, and other computational resources involved in generating responses to an input prompt using a generative artificial intelligence model.
[0020] Speculative Decoding in Generative Artificial Intelligence Models
[0021] Generally, autoregressive token generation (e.g., in large language models) may take historical tokens as an input in order to generate an output. That is, autoregressive token generation may be represented by the expression: xt ~ p (x|x0, x1, …, xt-1) → xt+1 ~ p (x|x0, x1, …, xt-1, xt)
[0022] where xt represents a sequence of tokens generated at time t, having a conditional probability p conditioned on the selection of tokens x0 through xt-1, and xt+1 represents a sequence of tokens generated at time t + 1, having a conditional probability pconditioned on the selection of tokens x0 through xt. Generally, a single token may be generated each time an autoregressive model is executed, which means that N inferences may be performed to generate a sequence of N tokens. As discussed above, speculative decoding techniques can be used to accelerate token generation by using a draft model, smaller in size than the target model, that speculatively generates tokens faster than the target model, with the target model being used to verify the tokens (speculatively) generated by the draft model.
[0023] In a speculative decoding pipeline, the draft model may speculatively generate n tokens autoregressively, according to the expression:
[0024] where t corresponds to a point in time, corresponds to the conditional probability distribution associated with a selected token x at time t conditioned on the selection of tokens x0 through xt-1, and represents a token x speculatively generated at time t by the draft model.
[0025] The target model takes the generated n tokens and processes the n tokens in parallel to generate probability distributions for each of the n tokens, according to the expression:
[0026] where k corresponds to a token index relative to the generated n tokens and corresponds to a probability distribution generated by the target model at time t for the tokens x generated by the draft model.
[0027] The target model can then verify the tokens generated by the draft model by comparing distributions from the draft model and target model to determine whether a token is accepted or rejected. A given token may be accepted when for some function f and some threshold α (also known as an acceptance rate) . Otherwise, the token may be rejected. The final token may then be generated at the first rejection position or at the last position n based on some function
[0028] Speculative decoding, with an acceptance rate of α, may result in cost reductions relative to using a single autoregressive model to generate tokens iteratively. Inference cost savings, relative to iterative token generation, may be represented by the expression:
[0029] where N corresponds to a number of tokens, CAR corresponds to a computational cost using an acceptance rate of α, Ctarget corresponds to a computational cost of generating a set of tokens using the target model, Cdraft corresponds to a computational cost of generating a set of tokens using the draft model, CSD corresponds to a computational cost of speculatively generating a set of tokens using the draft model, and n corresponds to a number of tokens generated speculatively in a single pass through an autoregressive model. Consider an example in which N = 1000, Ctarget=10, Cdraft=1, n=4, and α=3. In such an example, speculative decoding may result in a 35%reduction in computational expense relative to autoregressive iterative token generation alone.
[0030] However, speculative decoding on a per-token basis, as discussed, may impose limits on the rate at which tokens are generated, as a first token may be sampled individually by a draft model and then verified by a target model before the next token is sampled by the draft model and verified by the target model. That is, generating a response to an input prompt using per-token speculative decoding techniques may involve executing the draft model and target model for each token generated as part of a response to the input prompt, which may use significant amounts of computational resources (e.g., processor time, memory, memory bandwidth, etc. ) in order to generate the response.
[0031] Speculative decoding may also be implemented using one or more layers added to a target model. These additional layers, which may include additional embedding, autoregressive, and our language model layers inserted into the target model, or other additional layers, may allow for a draft model to speculatively generate a response to an input prompt. These additional layers, however, may have a significant impact on the memory footprint of a draft model deployed on a device. For example, the number of parameters introduced by these additional layers may involve the use of a significant amount of memory resources on a device on which the draft model is deployed. For example, for a target model with seven billion parameters, the additional layers inserted into the draft model may add an additional 700 million parameters, with a corresponding footprint being based on the data type used to implement these parameters. For example, if these parameters are defined as 16-bit floating-point values, the additional memory overhead may be 1.4 gigabytes on top of the memory footprint of the draft model, which may limit the devices on which such draft models may be deployed.
[0032] Example Memory-Efficient Speculative Decoding in Generative Artificial Intelligence Models
[0033] FIG. 1 illustrates an example pipeline 100 for efficient response generation using generative artificial intelligence models, according to certain aspects of the present disclosure.
[0034] In the pipeline 100, a target model 110 may include an embedding layer 112, a plurality of transformer layers 1141, 1142, …, 114N (collectively referred to as “transformer layers 114” ) , and a language model head 116. To generate an output, which may include one or more tokens generated in response to an input prompt 102, the target model 110 may generate an embedding representation of the input prompt 102 using the embedding layer 112. The embedding representation may be processed by the plurality of transformer layers 114, which each may generate an attention output over the parameters of the target model. The final attention output of the transformer layers 114 (e.g., the output of the transformer layer 114N) may be input into the language model head 116, which generates an probability distribution over a universe of tokens. The probability distribution generated by the language model head 116 may include a probability distribution over a single token or multiple tokens conditioned on the likelihood of a previous token being accepted as a valid response to the input prompt 102. The probability distribution generated by the language model head 116 may be output to a sampler 118 which identifies the token (s) to be output as the response to the input prompt (e.g., the tokens with the highest probabilities in the probability distribution generated by the language model head 116) and outputs the sampled tokens to an output verification block 130 for further processing.
[0035] To reduce the memory footprint of a draft model 120 in the pipeline 100, the draft model 120 may share M of the N transformer layers 114 in the target model 110. As illustrated, the draft model 120 may be adapted to be smaller than the target model 110 but have behavior that approximates the behavior of the target model 110 by introducing M adapters 1241, 1242, …, 124M (collectively referred to as “adapters 124” ) through which the outputs of the transformer layers 1141-114M are processed.
[0036] Generally, each transformer layer 114 in the target model 110 may be configured to generate an output h based on a set of pretrained weights W, represented by the expression where d corresponds to a dimension of the input n corresponds to a number of tokens in the input, and k corresponds to a number of keys included in the target model 110. To generate an output h for the base task for which the target model 110 is trained, the target model 110 can apply the pretrained weights Wto the input x. For example, the output h, having dimensions of k×n, may be represented by the equation: h=Wx
[0037] To allow the draft model 120 to efficiently generate tokens in response to an input prompt 102 using a smaller model that approximates the behavior of the target model 110, the adapters 124 may be trained with adapter weights including learnable matrices A and B. These adapter weights may, for example, be trained to minimize a difference between tokens generated by the draft model 120 and tokens generated by the target model 110 for the same input prompt 102. The weights of the transformer layers 114 may be frozen (e.g., fixed after training the target model 110) to constrain learning (or updating) to learnable matrices A and / or B for the adapters 124. The constraints on updating the pretrained weights W may be performed by representing the updates to the pretrained weights W to a low-rank decomposition, such that the weights associated with inferencing using the draft model 120 are represented by the pretrained weights W and a delta weight ΔW=AB. Thus, the output h for the downstream task for which the machine learning model is adapted may be represented by the equation: h=Wx+ΔWx=Wx+ABx
[0038] Generally, the adapter weights, defined as the learnable matrices A and B, may be low-rank matrices that allow for changes in the weights of the target model 110 to be projected into a smaller subspace. For example, the first learnable matrix A may be represented by the expression and the second learnable matrix B may be represented by the expression where r represents the rank of these matrices and r<<min (d, k) . In some aspects, the learnable matrix A may be initialized as a random matrix (e.g., using Gaussian initialization) , and the learnable matrix B may be initialized as a matrix with all zero values, such that ΔW=AB=0 before the target model 110 is adapted into the draft model 120, which, as discussed, may include a subset of the transformer layers of the target model 110 to reduce the memory overhead of the draft model. During adaptation to generate values in the matrices A and B that adapt the pretrained weights W from the weights associated with the target model 110 to the adapter weights associated with the draft model 120, ΔWx may be scaled by the factor where α is constant in r. In some aspects, tuning α may adjust the learning rate and may be set to the first value of r used in adapting the target model 110 so that the hyperparameters of the target model 110 need not be retuned as r is adjusted.
[0039] During inferencing, the draft model 120 may project the input prompt into an embedding representation using the embedding layer 112, which, as illustrated, is shared with the target model 110. The embedding representation of the input prompt may be processed using the M transformer layers 1141-114M and the corresponding adapters 1241-124M. The output of these M transformer layers 1141-114M and the corresponding adapters 1241-124M, which may be an attention map or other attention output over a universe of keys for the draft model 120, may be input into a language model head 126 which, similarly to the language model head 116 of the target model 110 discussed above, which identifies the token (s) to be output as the response to the input prompt (e.g., the tokens with the highest probabilities in the probability distribution generated by the language model head 126) and outputs the sampled tokens to the output verification block 130 for further processing.
[0040] The output verification block 130 generally compares the tokens speculatively generated by the draft model 120 to the tokens generated by the target model 110 to determine which tokens are to be accepted as a valid response to the input prompt and thus appended to the input prompt 102 for processing in a subsequent inferencing round using the target model 110 and the draft model 120. Generally, the valid tokens 140 selected by the output verification block 130 and output as a response to the input prompt may include tokens generated by the draft model 120 that are also generated in the same order by the target model 110.
[0041] FIG. 2 illustrates an example 200 of efficient multi-token speculative sampling in generative artificial intelligence models, according to certain aspects of the present disclosure.
[0042] In the example 200, as illustrated, the target model 110 and the draft model 120 may be configured to generate multiple tokens as a candidate response to the input prompt 210 to accelerate the generation of a response to the input prompt 210 relative to single-token generation of a response. While FIG. 2 illustrates the generation of three ground-truth tokens 2201 through 2203 (collectively “ground-truth tokens 220” and illustrated as tokens T1 through T3) by the target model 110 and three speculative tokens 2301 through 2303 (collectively “speculative tokens 230” and illustrated as tokens D1 through D3) , it should be recognized that the target model 110 and the draft model 120 may be configured to generate any number of tokens during an inferencing round.
[0043] The ground-truth tokens 220 may be, as illustrated, the ordered list of tokens 2201, 2202 (which depends on the generation of the token 2201 as the previous token) , and 2203 (which depends on the generation of the tokens 2201 and 2202 as the previous tokens) . Similarly, the speculative tokens 230 may be the ordered list of tokens 2301, 2302, and 2303, with each token in the ordered list being conditioned on the generation of the previous tokens in the ordered list. During verification in the output verification block 130, the speculative tokens 230 may be compared to the corresponding ground-truth tokens 220 to determine which tokens can be output as a response to the input prompt 210. As illustrated, thus, the first speculative token 2301 may be compared to the first ground-truth token 2201 to determine whether the first speculative token 2301 is accepted or rejected. Because the first speculative token 2301 matches the first ground-truth token 2201, the first speculative token 2301 may be accepted, and a comparison may proceed to the next token. If, however, the first speculative token 230 were to be rejected, the output verification block 130 may select the first ground-truth token 2201 as the accepted token, and append the accepted token to the input prompt 210 for use in the next inferencing round using the target model 110 and the draft model 120.
[0044] As illustrated, because the first speculative token 2301 matches the first ground-truth token 2201, the output verification block 130 may proceed to compare the second speculative token 2302 to the second ground-truth token 2202. In the example 200, because the second speculative token 2302 matches the second ground-truth token 2202, the second ground-truth token 2202 may be verified and included in a response to the input prompt 210, and the output verification block 130 may proceed to verifying the third speculative token 2303. In the example 200, because the third speculative token 2303 does not match the third ground-truth token 2203, the third ground-truth token 2203 may be included in the set of accepted tokens, and token verification by the output verification block 130 may terminate.
[0045] The resulting valid tokens 140 identified by the output verification block 130 may thus include the tokens D1 and D2 (the speculative tokens 2301 and 2302) . The valid tokens 140, along with the ground-truth token 2203, may be output as a response to the input prompt 210. Finally, the input prompt 210 may be overwritten with the valid tokens 140 and the ground-truth token 2203, and a subsequent inferencing round may be executed to generate additional portions of a response to the input prompt.
[0046] In some aspects, the target model 110 and the draft model 120 may be selectively executed. For example, the draft model 120 may be enabled for the speculative generation of draft tokens in response to an input prompt. After the draft model 120 executes and speculatively generates a set of draft tokens, the draft model 120 may be disabled, and the target model 110 may execute to verify the set of draft tokens generated by the draft model 120. The enabling and disabling of the draft model 120 may be repeatedly performed until a terminating event occurs. A terminating event may include, for example, a failure to verify any token generated by the draft model 120, the generation and verification of a terminating token representing the end of a response to an input prompt, or the like.
[0047] Because the draft model 120 uses adapters associated with a subset of the transformer layers 114 in the target model to implement a draft model that approximates the behavior of the target model 110, aspects of the present disclosure may significantly reduce the memory footprint of the draft model and correspondingly reduce the computational expense involved in the speculative generation of responses to input prompts using a generative artificial intelligence model. For example, for a target model 110 trained with 7 billion parameters, the use of adapters may reduce the overhead of the draft model 120 from 700 million additional parameters with a memory footprint of 1.4 gigabytes (for 16-bit floating-point parameters) as discussed above to under 150 million additional parameters with a memory footprint of under 300 megabytes (for 16-bit floating-point parameters) . Because the memory footprint and thus the number of operations performed by the draft model 120 may be reduced, aspects of the present disclosure may allow for draft models to be deployed and efficiently execute on a variety of computing devices, including edge devices (e.g., smartphones, tablet computers, laptop computers, wearable devices, Internet-of-Things (IoT) devices, or the like) which may have various memory and computational constraints due to limited resource available in comparison to cloud compute instances on which generative artificial intelligence models can execute.
[0048] Example Operations for Memory-Efficient Speculative Decoding in Generative Artificial Intelligence Models
[0049] FIG. 3 illustrates example operations 300 that may be performed by a computing device to efficiently generate a response to an input prompt using generative artificial intelligence models (e.g., as discussed herein with respect to FIGs. 1 and 2) , according to certain aspects of the present disclosure. The operations 300 may be performed by a computing device on which at least a draft model can be deployed, such as a smartphone, a tablet computer, a laptop computer, a desktop computer, a server, a cloud compute instance hosted in a distributed computing environment, or the like.
[0050] As illustrated, the operations 300 may begin at block 310, with receiving an input prompt for processing.
[0051] At block 320, the operations 300 proceed with generating a response to the input prompt using a first generative artificial intelligence model. Generally, the first generative artificial intelligence model includes (i) a subset of layers of a second generative artificial intelligence model and (ii) one or more adapters associated with the subset of layers of the second generative artificial intelligence model.
[0052] In some aspects, the one or more adapters are trained to cause the first generative artificial intelligence model to generate a response similar to the second generative artificial intelligence model for a given input. The one or more adapters may include, for example, low-rank adapters.
[0053] At block 330, the operations 300 proceed with outputting the generated response to the input prompt.
[0054] In some aspects, outputting the generated response comprises outputting the generated response to the second generative artificial intelligence model for verification. As discussed, the second generative artificial intelligence model may, in parallel or substantially in parallel with the first generative artificial intelligence model, generate a set of tokens corresponding to a response to the received input prompt. The response generated by the first generative artificial intelligence model may be verified based on a comparison of the tokens generated by the first generative artificial intelligence model and the second generative artificial intelligence model.
[0055] In some aspects, the first generative artificial intelligence model comprises a plurality of transformer layers. Each transformer layer of the plurality of transformer layers may be associated with an adapter from the one or more adapters. Weights of the plurality of transformer layers may comprise frozen weights, whereas weights of the one or more adapters may comprise trainable weights.
[0056] In some aspects, the generated response comprises a plurality of draft tokens. Outputting the generated response to the input prompt may include outputting the plurality of draft tokens to the second generative artificial intelligence model for verification. An indication of a set of verified tokens from the plurality of draft tokens may be received from the second generative artificial intelligence model, and the set of verified tokens may be output as the generated response to the input prompt. In some aspects, the first generative artificial intelligence model and the second generative artificial intelligence model execute on a same computing system.
[0057] In some aspects, the first generative artificial intelligence model and the second generative artificial intelligence model are large language models. The first generative artificial intelligence model generally generates outputs using a different language model output head than the second generative artificial intelligence model.
[0058] Example Processing Systems for Memory-Efficient Speculative Decoding for Response Generation in Generative Artificial Intelligence Models
[0059] FIG. 4 depicts an example processing system 400 for efficiently generating a response to a query input into a generative artificial intelligence model, such as described herein for example with respect to FIG. 3.
[0060] The processing system 400 includes a central processing unit (CPU) 402, which in some examples may be a multi-core CPU. Instructions executed at the CPU 402 may be loaded, for example, from a program memory associated with the CPU 402 or may be loaded from a memory partition (e.g., of a memory 424) .
[0061] The processing system 400 also includes additional processing components tailored to specific functions, such as a graphics processing unit (GPU) 404, a digital signal processor (DSP) 406, a neural processing unit (NPU) 408, and a connectivity component 412.
[0062] An NPU, such as the NPU 408, is generally a specialized circuit configured for implementing control and arithmetic logic for executing machine learning algorithms, such as algorithms for processing artificial neural networks (ANNs) , deep neural networks (DNNs) , random forests (RFs) , and the like. An NPU may sometimes alternatively be referred to as a neural signal processor (NSP) , tensor processing unit (TPU) , neural network processor (NNP) , intelligence processing unit (IPU) , vision processing unit (VPU) , or graph processing unit.
[0063] NPUs, such as the NPU 408, are configured to accelerate the performance of common machine learning tasks, such as image classification, machine translation, object detection, and various other predictive models. In some examples, a plurality of NPUs may be instantiated on a single chip, such as a system on a chip (SoC) , while in other examples such NPUs may be part of a dedicated neural-network accelerator.
[0064] NPUs may be optimized for training or inference, or in some cases configured to balance performance between both. For NPUs that are capable of performing both training and inference, the two tasks may still generally be performed independently.
[0065] NPUs designed to accelerate training are generally configured to accelerate the optimization of new models, which is a highly compute-intensive operation that involves inputting an existing dataset (often labeled or tagged) , iterating over the dataset, and then adjusting model parameters, such as weights and biases, in order to improve model performance. Generally, optimizing based on a wrong prediction involves propagating back through the layers of the model and determining gradients to reduce the prediction error.
[0066] NPUs designed to accelerate inference are generally configured to operate on complete models. Such NPUs may thus be configured to input a new piece of data and rapidly process this new piece through an already trained model to generate a model output (e.g., an inference) .
[0067] In some implementations, the NPU 408 is a part of one or more of the CPU 402, the GPU 404, and / or the DSP 406. These may be located on a user equipment (UE) in a wireless communication system or another computing device.
[0068] In some examples, the connectivity component 412 may include subcomponents, for example, for third generation (3G) connectivity, fourth generation (4G) connectivity (e.g., Long-Term Evolution (LTE) ) , fifth generation (5G) connectivity (e.g., New Radio (NR) ) , Wi-Fi connectivity, Bluetooth connectivity, and other wireless data transmission standards. The connectivity component 412 may be further coupled to one or more antennas 414.
[0069] The processing system 400 may also include one or more sensor processing units 416 associated with any manner of sensor, one or more image signal processors (ISPs) 418 associated with any manner of image sensor, and / or a navigation processor 420, which may include satellite-based positioning system components (e.g., GPS or GLONASS) as well as inertial positioning system components.
[0070] The processing system 400 may also include one or more input and / or output devices 422, such as screens, touch-sensitive surfaces (including touch-sensitive displays) , physical buttons, speakers, microphones, and the like.
[0071] In some examples, one or more of the processors of the processing system 400 may be based on an ARM or RISC-V instruction set.
[0072] The processing system 400 also includes the memory 424, which is representative of one or more static and / or dynamic memories, such as a dynamic random access memory, a flash-based static memory, and the like. In this example, the memory 424 includes computer-executable components, which may be executed by one or more of the aforementioned processors of the processing system 400.
[0073] In particular, in this example, the memory 424 includes an input prompt receiving component 424A, a response generating component 424B, a response outputting component 424C, and generative artificial intelligence models 424D. The depicted components, and others not depicted, may be configured to perform various aspects of the methods described herein.
[0074] Generally, the processing system 400 and / or components thereof may be configured to perform the methods described herein.
[0075] Example Clauses
[0076] Implementation details of various aspects of the present disclosure are described in the following numbered clauses.
[0077] Clause 1: A processor-implemented method for machine learning, comprising: receiving an input prompt for processing; generating a response to the input prompt using a first generative artificial intelligence model comprising a subset of layers of a second generative artificial intelligence model and one or more adapters associated with the subset of layers of the second generative artificial intelligence model; and outputting the generated response to the input prompt.
[0078] Clause 2: The method of Clause 1, wherein outputting the generated response comprises outputting the generated response to the second generative artificial intelligence model for verification.
[0079] Clause 3: The method of Clause 1 or 2, wherein the one or more adapters are trained to cause the first generative artificial intelligence model to generate response similar to the second generative artificial intelligence model for a given input.
[0080] Clause 4: The method of Clause 3, wherein the one or more adapters comprise low-rank adapters.
[0081] Clause 5: The method of any of Clauses 1 through 4, wherein the first generative artificial intelligence model comprises a plurality of transformer layers, and wherein each transformer layer of the plurality of transformer layers is associated with an adapter from the one or more adapters.
[0082] Clause 6: The method of Clause 5, wherein weights of the plurality of transformer layers comprise frozen weights and wherein weights of the one or more adapters comprise trainable weights.
[0083] Clause 7: The method of any of Clauses 1 through 6, wherein the generated response comprises a plurality of draft tokens, and wherein outputting the generated response to the input prompt comprises: outputting the plurality of draft tokens to the second generative artificial intelligence model for verification; receiving, from the second generative artificial intelligence model, an indication of a set of verified tokens from the plurality of draft tokens; and outputting the set of verified tokens as the generated response to the input prompt.
[0084] Clause 8: The method of Clause 7, wherein the first generative artificial intelligence model and the second generative artificial intelligence model execute on a same computing system.
[0085] Clause 9: The method of any of Clauses 1 through 8, wherein the first generative artificial intelligence model and the second generative artificial intelligence model are large language models, and wherein the first generative artificial intelligence model generates outputs using a different language model output head than the second generative artificial intelligence model.
[0086] Clause 10: A processing system, comprising: at least one memory having executable instructions stored thereon; and one or more processors configured to execute the executable instructions in order to cause the processing system to perform the operations of any of Clauses 1 through 9.
[0087] Clause 11: A processing system comprising means for performing the operations of any of Clauses 1 through 9.
[0088] Clause 12: A non-transitory computer-readable medium having executable instructions stored thereon which, when executed by one or more processors, perform the operations of any of Clauses 1 through 9.
[0089] Additional Considerations
[0090] The preceding description is provided to enable any person skilled in the art to practice the various aspects described herein. The examples discussed herein are not limiting of the scope, applicability, or aspects set forth in the claims. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects. For example, changes may be made in the function and arrangement of elements discussed without departing from the scope of the disclosure. Various examples may omit, substitute, or add various procedures or components as appropriate. For instance, the methods described may be performed in an order different from that described, and various steps may be added, omitted, or combined. Also, features described with respect to some examples may be combined in some other examples. For example, an apparatus may be implemented or a method may be practiced using any number of the aspects set forth herein. In addition, the scope of the disclosure is intended to cover such an apparatus or method that is practiced using other structure, functionality, or structure and functionality in addition to, or other than, the various aspects of the disclosure set forth herein. It should be understood that any aspect of the disclosure disclosed herein may be embodied by one or more elements of a claim.
[0091] As used herein, the word “exemplary” means “serving as an example, instance, or illustration. ” Any aspect described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other aspects.
[0092] As used herein, a phrase referring to “at least one of” a list of items refers to any combination of those items, including single members. As an example, “at least one of: a, b, or c” is intended to cover a, b, c, a-b, a-c, b-c, and a-b-c, as well as any combination with multiples of the same element (e.g., a-a, a-a-a, a-a-b, a-a-c, a-b-b, a-c-c, b-b, b-b-b, b-b-c, c-c, and c-c-c or any other ordering of a, b, and c) .
[0093] As used herein, the term “determining” encompasses a wide variety of actions. For example, “determining” may include calculating, computing, processing, deriving, investigating, looking up (e.g., looking up in a table, a database or another data structure) , ascertaining, and the like. Also, “determining” may include receiving (e.g., receiving information) , accessing (e.g., accessing data in a memory) , and the like. Also, “determining” may include resolving, selecting, choosing, establishing, and the like.
[0094] The methods disclosed herein comprise one or more steps or actions for achieving the methods. The method steps and / or actions may be interchanged with one another without departing from the scope of the claims. In other words, unless a specific order of steps or actions is specified, the order and / or use of specific steps and / or actions may be modified without departing from the scope of the claims. Further, the various operations of methods described above may be performed by any suitable means capable of performing the corresponding functions. The means may include various hardware and / or software component (s) and / or module (s) , including, but not limited to a circuit, an application specific integrated circuit (ASIC) , or processor. Generally, where there are operations illustrated in figures, those operations may have corresponding counterpart means-plus-function components with similar numbering.
[0095] The following claims are not intended to be limited to the aspects shown herein, but are to be accorded the full scope consistent with the language of the claims. Within a claim, reference to an element in the singular is not intended to mean “one and only one” unless specifically so stated, but rather “one or more. ” Unless specifically stated otherwise, the term “some” refers to one or more. No claim element is to be construed under the provisions of 35 U.S.C. § 112 (f) unless the element is expressly recited using the phrase “means for” or, in the case of a method claim, the element is recited using the phrase “step for. ” All structural and functional equivalents to the elements of the various aspects described throughout this disclosure that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims. Moreover, nothing disclosed herein is intended to be dedicated to the public regardless of whether such disclosure is explicitly recited in the claims.
Claims
1.A processing system for machine learning, comprising:at least one memory having executable instructions stored thereon; andone or more processors configured to execute the executable instructions to cause the processing system to:receive an input prompt for processing;generate a response to the input prompt using a first generative artificial intelligence model comprising a subset of layers of a second generative artificial intelligence model and one or more adapters associated with the subset of layers of the second generative artificial intelligence model; andoutput the generated response to the input prompt.2.The processing system of Claim 1, wherein to output the generated response, the one or more processors are configured to cause the processing system to output the generated response to the second generative artificial intelligence model for verification.3.The processing system of Claim 1, wherein the one or more adapters are trained to cause the first generative artificial intelligence model to generate response similar to the second generative artificial intelligence model for a given input.4.The processing system of Claim 3, wherein the one or more adapters comprise low-rank adapters.5.The processing system of Claim 1, wherein the first generative artificial intelligence model comprises a plurality of transformer layers and wherein each transformer layer of the plurality of transformer layers is associated with an adapter from the one or more adapters.6.The processing system of Claim 5, wherein weights of the plurality of transformer layers comprise frozen weights and wherein weights of the one or more adapters comprise trainable weights.7.The processing system of Claim 1, wherein the generated response comprises a plurality of draft tokens and wherein to output the generated response to the input prompt, the one or more processors are configured to cause the processing system to:output the plurality of draft tokens to the second generative artificial intelligence model for verification;receive, from the second generative artificial intelligence model, an indication of a set of verified tokens from the plurality of draft tokens; andoutput the set of verified tokens as the generated response to the input prompt.8.The processing system of Claim 7, wherein the first generative artificial intelligence model and the second generative artificial intelligence model execute on the processing system.9.The processing system of Claim 1, wherein the first generative artificial intelligence model and the second generative artificial intelligence model are large language models and wherein the first generative artificial intelligence model generates outputs using a different language model output head than the second generative artificial intelligence model.10.A processor-implemented method for machine learning, comprising:receiving an input prompt for processing;generating a response to the input prompt using a first generative artificial intelligence model comprising a subset of layers of a second generative artificial intelligence model and one or more adapters associated with the subset of layers of the second generative artificial intelligence model; andoutputting the generated response to the input prompt.11.The method of Claim 10, wherein outputting the generated response comprises outputting the generated response to the second generative artificial intelligence model for verification.12.The method of Claim 10, wherein the one or more adapters are trained to cause the first generative artificial intelligence model to generate response similar to the second generative artificial intelligence model for a given input.13.The method of Claim 12, wherein the one or more adapters comprise low-rank adapters.14.The method of Claim 10, wherein the first generative artificial intelligence model comprises a plurality of transformer layers, and wherein each transformer layer of the plurality of transformer layers is associated with an adapter from the one or more adapters.15.The method of Claim 14, wherein weights of the plurality of transformer layers comprise frozen weights and wherein weights of the one or more adapters comprise trainable weights.16.The method of Claim 10, wherein the generated response comprises a plurality of draft tokens, and wherein outputting the generated response to the input prompt comprises:outputting the plurality of draft tokens to the second generative artificial intelligence model for verification;receiving, from the second generative artificial intelligence model, an indication of a set of verified tokens from the plurality of draft tokens; andoutputting the set of verified tokens as the generated response to the input prompt.17.The method of Claim 16, wherein the first generative artificial intelligence model and the second generative artificial intelligence model execute on a same computing system.18.The method of Claim 10, wherein the first generative artificial intelligence model and the second generative artificial intelligence model are large language models, and wherein the first generative artificial intelligence model generates outputs using a different language model output head than the second generative artificial intelligence model.19.A computer-readable medium having executable instructions stored thereon which, when executed by one or more processors, perform an operation for machine learning, the operation comprising:receiving an input prompt for processing;generating a response to the input prompt using a first generative artificial intelligence model comprising a subset of layers of a second generative artificial intelligence model and one or more adapters associated with the subset of layers of the second generative artificial intelligence model; andoutputting the generated response to the input prompt.20.The computer-readable medium of Claim 19, wherein the first generative artificial intelligence model comprises a plurality of transformer layers and wherein each transformer layer of the plurality of transformer layers is associated with an adapter from the one or more adapters.
Citation Information
Patent Citations
Accelerator hardware and acceleration method based on large language model speculation sampling reasoning
CN117933401A
Dynamic guess decoding method and device for large language model, equipment and medium
CN118095209A
Efficient multi-turn generative AI model suggested message generation
US11947902B1
Training masked language models based on partial sequences of tokens
US20220382978A1