System and methods for mitigating attention noise in transformer models

WO2026218295A1PCT designated stage Publication Date: 2026-10-22HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/089734
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2026-10-22

Smart Images

  • Figure CN2025089734_22102026_PF_FP_ABST
    Figure CN2025089734_22102026_PF_FP_ABST
Patent Text Reader

Abstract

A method for generating an output sequence of tokens based on an input sequence of tokens is disclosed. An input sequence is processed using a decoder neural network that includes a first sequence of attention decoder layers. The decoder neural network is configured to process the input sequence through the first sequence of attention decoder layers to generate a time step output. Each of one or more of the attention decoder layers is configured to: determine a logit distribution of the attention decoder layer by computing attention scores based on key and query vectors for the attention decoder layer; apply a softmax function to an average of the logit distribution of the attention decoder layer to obtain attention weights; and determine an attention output of the attention decoder layer by computing a weighted sum of value vectors using the attention weights. A next token of the output sequence is determined based on the time step output.
Need to check novelty before this filing date? Find Prior Art

Description

SYSTEM AND METHODS FOR MITIGATING ATTENTION NOISE IN TRANSFORMER MODELSTECHNICAL FIELD

[0001] The present application relates to machine learning and, more particularly, to deep learning models for processing sequential data.BACKGROUND

[0002] The transformer is a ubiquitous deep learning architecture. At the core of the transformer is the self-attention mechanism, which employs a softmax function to weigh the importance of tokens in a sequence. Given an input token sequence, each token computes a weighted sum of all other tokens using “attention scores” . The transformer often allocates a disproportionately large proportion of attention scores to irrelevant tokens. The issue arises due to non-negligible attention scores, or “attention noise” , being assigned to irrelevant or misleading context. Attention noise in self-attention mechanisms interferes with the model’s ability to focus on the most relevant parts of the input during attention computations.SUMMARY

[0003] In an aspect, the present application discloses a computer-implemented method for generating an output sequence of tokens from an input sequence of tokens. The method may include: receiving an input sequence of tokens; processing the input sequence using a decoder neural network that includes a first sequence of attention decoder layers, wherein the decoder neural network is configured to process the input sequence through the first sequence of attention decoder layers to generate a time step output and wherein each of one or more of the attention decoder layers is configured to: determine a logit distribution of the attention decoder layer by computing attention scores based on key and query vectors for the attention decoder layer; apply a softmax function to an average of the logit distribution of the attention decoder layer to obtain attention weights; and determine an attention output of the attention decoder layer by computing a weighted sum of value vectors using the attention weights; and determining a next token of the output sequence based on the time step output.

[0004] In some implementations, the average of the logit distribution may comprise an expected value of the attention scores over a probability distribution.

[0005] In some implementations, the method may further include determining an approximation of the expected value using a defined number of signals sampled from the logit distribution, wherein the softmax function is applied to the approximation of the expected value.

[0006] In some implementations, each sampled signal may be computed using learned weight matrices associated with the key and query vectors.

[0007] In some implementations, each of the one or more attention decoder layers may be configured to implement multi-head attention.

[0008] In some implementations, the one or more attention decoder layers may comprise a defined number of terminal attention decoder layers in the first sequence and each attention decoder layer that precedes the terminal attention decoder layers in the first sequence may perform self-attention on their respective layer inputs.

[0009] In some implementations, the defined number may be half of a total number of attention decoder layers in the first sequence.

[0010] In another aspect, the present application discloses a computing system for generating an output sequence from an input sequence of tokens. The computing system includes a processor and memory coupled to the processor. The memory stores computer-executable instructions that, when executed by a processor, configure the processor to: receive an input sequence of tokens; process the input sequence using a decoder neural network that includes a first sequence of attention decoder layers, wherein the decoder neural network is configured to process the input sequence through the first sequence of attention decoder layers to generate a time step output and wherein each of one or more of the attention decoder layers is configured to: determine a logit distribution of the attention decoder layer by computing attention scores based on key and query vectors for the attention decoder layer; apply a softmax function to an average of the logit distribution of the attention decoder layer to obtain attention weights; and determine an attention output of the attention decoder layer by computing a weighted sum of value vectors using the attention weights; and determine a next token of the output sequence based on the time step output.

[0011] In another aspect, the present application discloses a non-transitory, computer-readable storage medium. The computer-readable medium stores instructions that, when executed by a processor, configure the processor to: receive an input sequence of tokens; process the input sequence using a decoder neural network that includes a first sequence of attention decoder layers, wherein the decoder neural network is configured to process the input sequence through the first sequence of attention decoder layers to generate a time step output and wherein each of one or more of the attention decoder layers is configured to: determine a logit distribution of the attention decoder layer by computing attention scores based on key and query vectors for the attention decoder layer; apply a softmax function to an average of the logit distribution of the attention decoder layer to obtain attention weights; and determine an attention output of the attention decoder layer by computing a weighted sum of value vectors using the attention weights; and determine a next token of the output sequence based on the time step output.

[0012] In another aspect, the present application discloses a non-transitory, computer-readable medium storing instructions that, when executed by a processor in a device, cause the processor to implement any of the methods disclosed herein.

[0013] In another aspect, the present application discloses a device that is configured to perform any of the methods disclosed herein.

[0014] In another aspect, the present application discloses a processor that is configured to execute instructions to cause a device to perform any of the methods disclosed herein.

[0015] In another aspect, the present application discloses an integrated circuit that is configured to perform any of the methods disclosed herein.

[0016] In another aspect, the present application discloses a module comprising one or more circuits for performing any of the methods disclosed herein.

[0017] In another aspect, the present application discloses an apparatus comprising one or more processors functionally connected to a memory for performing any of the methods disclosed herein.

[0018] In another aspect, the present application discloses an apparatus that is configured to perform any of the methods disclosed herein.

[0019] In another aspect, the present application discloses non-transitory, computer-readable storage media storing instructions that, when executed, cause at least one processing unit, at least one processor, or at least one circuit to perform any of the methods disclosed herein.

[0020] In another aspect, the present application discloses a computer program product including instructions that, when executed by an apparatus, enable the apparatus to implement any of the methods disclosed herein.

[0021] In another aspect, the present application discloses a computing system comprising a node for performing any of the methods disclosed herein.BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Embodiments are described in detail below, with reference to the following drawings:

[0023] FIG. 1 is a schematic diagram of a traditional transformer architecture;

[0024] FIG. 2 is a schematic diagram of an example operating environment in which embodiments of the present disclosure may be implemented;

[0025] FIG. 3A illustrates a high-level operation of an attention module in an integral transformer architecture;

[0026] FIG. 3B illustrates example computations of an attention decoder layer based on key, query, and value vectors;

[0027] FIG. 4 shows, in flowchart form, an example method for generating an output sequence of tokens from an input sequence of tokens in accordance with the integral transformer architecture;

[0028] FIG. 5A is a block diagram of an example computer system; and

[0029] FIG. 5B is a block diagram of an example computing device that is configured to implement the integral transformer architecture.

[0030] Like reference numerals are used in the drawings to denote like elements and features.DETAILED DESCRIPTION OF EMBODIMENTS

[0031] Embodiments disclosed herein relate to systems and apparatuses using transformer models. The systems and apparatuses disclosed herein may comprise suitable modules and / or circuitries for executing various procedures.

[0032] As those skilled in the art understand, a “module” is a term of explanation referring to a hardware structure such as a circuitry implemented using technologies such as electrical and / or optical technologies (and with more specific examples of semiconductors) for performing defined operations or processing. A “module” may alternatively refer to the combination of a hardware structure and a software structure, wherein the hardware structure may be implemented using technologies such as electrical and / or optical technologies (and with more specific examples of semiconductors) in a general manner for performing defined operations or processing according to the software structure in the form of a set of instructions stored in one or more non-transitory, computer-readable storage devices or media.

[0033] A module may be a part of a device, an apparatus, a system, and / or the like, wherein the module may be coupled to or integrated with other parts of the device, apparatus, or system such that the combination thereof forms the device, apparatus, or system. Alternatively, the module may be implemented as a standalone device or apparatus.

[0034] The module usually executes a procedure for performing a method. Herein, a procedure has a general meaning equivalent to that of a method. More specifically, a procedure is a defined method implemented using hardware components for processing data. A procedure may comprise or use one or more functions for processing data as designed. Herein, a function is a defined sub-procedure or sub-method for computing, calculating, or otherwise processing input data in a defined manner and generating or otherwise producing output data.

[0035] As those skilled in the art will appreciate, a procedure may be implemented as one or more software and / or firmware programs having necessary computer-executable code or instructions and stored in one or more non-transitory computer-readable storage devices or media which may be any volatile and / or non-volatile, non-removable or removable storage devices such as RAM, ROM, EEPROM, solid-state memory devices, hard disks, CDs, DVDs, flash memory devices, and / or the like. A module may read the computer-executable code from the storage devices and execute the computer-executable code to perform the procedure.

[0036] Alternatively, a procedure may be implemented as one or more hardware structures having necessary electrical and / or optical components, circuits, logic gates, integrated circuit (IC) chips, and / or the like. Attention De-noising for Transformers

[0037] Transformers have revolutionized the fields of natural language processing and computer vision, and made significant contributions to the broader evolution of artificial intelligence. The transformer is a deep learning architecture that is designed to handle sequential data in an efficient and scalable manner. It relies on a “self-attention” mechanism to process and model relationships between elements of sequences. Large language models (LLMs) employ the transformer architecture as their backbone because of its ability to handle long-range dependencies, parallelize model training, and scale efficiently with large datasets. Examples of transformer-based LLMs include the Bidirectional Encoder Representations from Transformers (BERT) model, the Transformer-XL model, and the Generative Pre-trained Transformer (GPT) models.

[0038] The core component of the transformer is the self-attention mechanism, which enables models to weigh the importance of different elements (or “tokens” ) in a sequence when generating contextual embeddings. Self-attention dynamically computes the importance, or attention, of each token in a sequence relative to all other tokens. FIG. 1 illustrates a traditional transformer architecture. The transformer 100 has two main components: an encoder 110 which processes an input sequence and generates contextual embeddings, and a decoder 120 which generates an output sequence by attending to encoder outputs and previously generated tokens. The encoder 110 is designed to capture relationships and dependencies between all tokens in the sequence, converting input tokens into dense, contextualized vector representations. The encoder 110 comprises a stack of identical encoder layers. An encoder layer transforms an input sequence into a continuous, abstract representation that captures the learned information from the entire sequence. Each encoder layer includes a multi-head attention sub-layer and a feedforward neural network. The multi-head attention runs multiple (softmax-based) self-attention computations in parallel –each “head” has different learned parameters and focuses on different aspects of the input sequence. The individual attention outputs from each head are combined (e.g., by adding, concatenating, etc. ) to produce a final output of the multi-head attention sub-layer. Following the multi-head attention, the output is passed through the feedforward neural network, which is composed of two linear transformations with a rectified linear unit (ReLU) activation in between.

[0039] The output of the final encoder layer is a set of vectors, each representing the input sequence with contextual understanding. This output is then used as input for the decoder 120. The decoder 120 generates an output sequence token-by-token, utilizing both the encoder embeddings and previously generated tokens to predict the next token. The decoder 120 comprises a stack of identical decoder layers. A decoder layer includes a similar set of sub-layers as an encoder layer. In particular, each decoder layer includes masked multi-head self-attention, encoder-decoder attention, and a feedforward neural network. Each sub-layer in the encoder 110 and decoder 120 is followed by a normalization step, and the output of each sub-layer is combined with the input using residual connections. The decoder output passes through a final linear layer and a softmax function to generate probability distributions over the set of all possible outputs (i.e., the “vocabulary” ) , and the most likely token is chosen for generation.

[0040] The softmax-based self-attention is computed using query, key, and value vectors that are derived from input embeddings. More specifically, each token of the input sequence is transformed into query, key, and value vectors using learned weight matrices. These vectors determine how much attention each token should pay to the others. The main operation in the self-attention mechanism is the calculation of a weighted sum of all tokens’ value vectors, where the attention weights are determined using a measure of similarity between the query and key vectors (i.e., attention scores) . The attention score for a pair of tokens in the input sequence is computed using a dot product of their query and key vectors. This calculation produces a matrix of attention scores, having rank n for a sequence of n tokens. The attention scores are scaled (by dividing them by where dk is the dimensionality of the key / query vectors) to obtain adjusted scores, and a softmax function is applied to the adjusted scores to obtain the attention weights. These weights determine the amount of “attention” each word in the sequence should receive. Each token attends to all other tokens in the sequence, thereby capturing both local and long-range dependencies.

[0041] The traditional transformer often over-attends to irrelevant context. Specifically, the transformer may allocate disproportionately large attention scores to tokens that lack semantic importance, such as special tokens and punctuation. Special tokens refer to extra tokens added to an input sequence that serve a specific function. These tokens guide a model to understand structure, position, or intent within the input. Examples of special tokens include [BOS] (Beginning of sequence) , [SEP] (Separator token, used to separate segments in a sequence) , [PAD] (Padding token, used to pad shorter sequences in a batch to the same length) , and the like. The tendency of the attention mechanism to assign non-negligible attention scores to irrelevant context is known as “attention noise” . Attention noise can degrade model performance, especially in complex tasks requiring nuanced understanding and reasoning. A transformer model may fail to attend to key tokens as a result of attention noise, which can reduce task accuracy. Noisy attention may make it difficult to trace reasoning or decisions through attention patterns. In generative tasks, focusing on unrelated or extraneous context can lead to producing hallucinated or inaccurate output. Attention noise may also result in poor model robustness, as sensitivity to irrelevant parts of the context may reduce reliability under input perturbations.

[0042] Various solutions for mitigating attention noise have been proposed. “Cog Attention” (Lv et al., 2024) is an attention mechanism that enables attention weights to be negative for enhanced expressiveness. Unlike traditional softmax attention, Cog Attention applies an exponential function to the query-key inner products and normalizes them using the sum of their absolute values. Negative weights allow the model to reduce attention to non-informative or irrelevant tokens (e.g., special tokens, punctuation, etc. ) . Additionally, models employing Cog Attention may demonstrate greater robustness against representational collapse –a phenomenon where representations become homogeneous, especially in later positions of a sequence, within deep transformer models. By permitting negative attention weights, Cog Attention reduces the effective information paths from earlier tokens to later positions, helping to alleviate over-squashing.

[0043] The Differential Transformer (Ye et al., 2024) introduces a differential attention mechanism that is designed to mitigate over-allocation of attention to irrelevant context. Attention noise is “canceled” with differential de-noising. Specifically, the query and key vectors are partitioned into two groups and two separate softmax attention maps are computed. The difference between the softmax attention maps is calculated to obtain the final attention scores. The subtraction effectively removes shared irrelevant patterns (i.e., common-mode noise) and amplifies task-relevant distinctions. The Differential Transformer allocates higher attention weights to key information and focuses more on meaningful context, resulting in sparser and more precise attention distributions.

[0044] A major limitation of known approaches to mitigating attention noise is over-aggressive noise reduction. Cog Attention and Differential Transformer both allow attention scores to become negative for non-informative tokens, such as special tokens and punctuation. While this reduces attention noise, it risks discarding useful information. Special tokens (e.g., [BOS] ) play a crucial role in model performance, acting as "attention sinks" that stabilize attention mechanisms, especially in tasks like few-shot learning and chain-of-thought reasoning. Negative attention scores may inadvertently degrade model performance by unduly suppressing attention to these critical tokens.

[0045] Despite the advances of Cog Attention and Differential Transformer in addressing attention noise, these attention mechanisms are limited in balancing noise reduction with the preservation of attention to special tokens. Furthermore, the mechanisms apply their noise-reduction strategies uniformly across all attention layers, ignoring the varying behavior of attention across different depths of the transformer and resulting in sub-optimal performance.

[0046] The present application proposes a transformer architecture –the “integral transformer” –which has a self-attention mechanism that addresses attention noise by integrating signals sampled from a logit distribution. The integral transformer effectively balances attention scores without completely eliminating or negatively weighting attention to special tokens and punctuation, thereby preserving the role of special tokens as "attention sinks" . The integral transformer employs a layer-hybridization strategy, applying its de-noising mechanism only to the “upper” (or terminal) layers of the transformer while retaining vanilla self-attention in the “lower” (or initial) layers. This approach leverages the observation that the initial layers of the transformer benefit from local attention patterns, while deeper layers require noise reduction to prevent rank collapse and improve global context understanding. By combining these modifications, the integral transformer is designed to achieve a more balanced and efficient attention mechanism.

[0047] FIG. 2 is a schematic diagram of an example operating environment in which embodiments of the present disclosure may be implemented. As illustrated, the cloud server 220 and a plurality of edge devices 250 communicate via a network 230. The cloud server 220 is configured to manage, train, and deploy machine learning (ML) models to edge devices 250. The cloud server 220 provides centralized data processing, by collecting and processing data from various sources and making it available for inference and retraining. The cloud server 220 may host a larger model or an ensemble of efficient large language models (LLMs) , handling complex, resource-intensive computations. It is configured to provide real-time responses to lightweight and edge-based systems, and manages data security, model updates, and data storage.

[0048] The edge devices 250 are computing devices, such as local computing systems or Internet-of-Things (IoT) devices. The edge devices 250 run ML models directly on-device, reducing latency and reliance on the cloud server 220. The edge devices 250 may take a variety of forms including, for example, desktop computers, mobile and wearable devices (e.g., smartphones, tablet computers, head-mounted displays or smartwatches) , in-vehicle devices, embedded systems, industrial edge servers, or computing devices of other types. Optimized, lightweight versions of the proposed integral transformer model may reside on the edge devices 250 to deliver low-latency responses without needing constant cloud connectivity. The edge devices 250 manage simpler, time-sensitive tasks and handle tasks locally whenever possible, offloading critical computations requiring additional resources to the cloud server 220.

[0049] ML models are trained server-side using large datasets which may be collected from various sources, including cloud storage, databases, or edge devices 250. A trained model is optimized and deployed to the edge devices 250. For example, the edge devices 250 may pull the latest model from a centralized model registry or the model updates may be sent to the edge devices 250 automatically or manually. The edge devices 250 can then load the deployed model and perform real-time inference. Since inference occurs locally, decisions can be made instantly without waiting for server responses. The edge devices provide data feedback, by collecting results from inferences and user interactions and sending data back to the cloud server 220 for model retraining. The cloud server 220 is configured to periodically update the edge models based on new training.

[0050] The deployment of integral transformer models may offer significant potential for enhancing the performance and scalability of cloud-based artificial intelligence solutions. Various cloud services can leverage the integral transformer architecture to reduce latency and improve throughput while handling increased volume of requests. The de-noising ability and scalability of the proposed architecture is particularly advantageous for enterprise-level applications, where efficient handling of voluminous data streams is critical. The ability to deploy large-scale integral transformer models enables cloud services to deliver robust, high-performance language modeling in a wide range of domains. The proposed architecture also facilitates efficient on-device inference. The implementation of small integral transformer models endows powerful AI capabilities on resource-constrained hardware environments, such as mobile assistants and automotive systems. By employing smaller-scale integral transformers, it becomes feasible to achieve substantial reductions in latency and energy consumption. The ability to run high-quality inference on-device can ensure enhanced privacy, reduced reliance on cloud connectivity, and increased responsiveness, leading to overall improvements in user experience.

[0051] The network 230 is a computer network. In some embodiments, the network 230 may be an internetwork such as may be formed of one or more interconnected computer networks. For example, the network 230 may be or may include an Ethernet network, an asynchronous transfer mode (ATM) network, a wireless network, or the like.

[0052] Reference is now made to FIG. 4 which shows, in flowchart form, an example method 400 for generating an output sequence of tokens from an input sequence of tokens in accordance with an integral transformer architecture. The method 400 may be implemented for mitigating attention noise during inference using a transformer model. By way of example, the method 400 may usefully de-noise attention during sequence (e.g., text) generation using large language models (LLMs) . In decoder-only transformers, such as GPT, LLaMA, etc., the models generate an autoregressive output sequence where each token depends on previous ones. For example, a GPT-based model predicts each token one at a time by sampling from a vocabulary. In encoder-decoder transformers, the models take an input sequence and generate a new output sequence (e.g., machine translation) . The operations of method 400 may be performed by a computing system, such as a cloud server and / or an edge device shown in FIG. 2. For example, an attention module implemented by a computing system that is configured to deploy transformer models may perform the method 400. In at least some implementations, the method 400 may be implemented in the decoder layers of a decoder (such as the decoder 120 in FIG. 1) neural network. More particularly, the self-attention sub-layers of the decoder layers may perform the operations of method 400 when computing attention for inputs to a transformer model.

[0053] In operation 402, the computing system receives an input sequence of tokens. The input sequence is a series of tokens that are fed into a model, and may be in the form of a single input sequence or multiple concatenated sequences, text prompt, and the like. The input sequence undergoes several key pre-processing steps. More particularly, the raw input data (e.g., raw text) is converted into numerical representations that a model can process. The pre-processing steps ensure that tokens retain meaning, context, and positional information. The input sequence is converted to tokens, which can be words, sub-words, characters, etc. Each token may be assigned a unique token ID from the model’s vocabulary. Once tokens are obtained, they are mapped to vector representations, i.e. embeddings, using a learned embedding matrix. In at least some implementations, positional encoding is added to retain sequence order information for the input sequence.

[0054] After the token embeddings and positional encodings are applied to the input sequence, a final input matrix is processed, and the computing system proceeds with attention computation based on this input matrix. In operation 404, the computing system processes the input sequence using a decoder neural network that includes a first sequence of attention decoder layers. The first sequence may, for example, comprise a stack of identical attention decoder layers. The decoder neural network is configured to process the input sequence through the first sequence of attention decoder layers to generate a time step output. The time step output is an output representation (or embedding) generated for a token in a sequence after processing it through one or more layers of the decoder neural network.

[0055] One or more of the attention decoder layers of the first sequence is each configured to perform operations 406 to 410. In operation 406, the computing system determines a distribution of logits in a given attention decoder layer. The logit distribution is determined by computing attention scores based on query and key vectors for the attention decoder layer. As shown in FIG. 3B, the computing system performs matrix multiplication (MatMul) between the query Q and key K vectors, generating a matrix of compatibility function outputs. Specifically, the attention logits are computed using matrix multiplication, which produces

[0056] The computing system applies a softmax operation to an average of the logit distribution of the attention decoder layer to obtain attention weights, in operation 408. In particular, rather than using direct attention scores, multiple signals are sampled from the logit distribution in order to determine the average, and this average is provided as input to the softmax function. In at least some implementations, the average of the logit distribution comprises an expected value of the attention scores over a probability distribution. Instead of the standard softmax operation, an integrated attention function, defined as the expectation over a probability distribution P (x) , is used. The integrated attention function is expressed as: φ (x) =softmax (EP (x) [QKT] )

[0057] In at least some implementations, the computing system determines an approximation of the expected value using a defined number of signals sampled from the logit distribution. That is, the integral transformer may adopt a statistical expectation-based integration of multiple signal representations. By way of example, the expectation may be approximated via Monte Carlo estimation, using S sampled signals: where each sampled signal is computed as for s=1, …, Sand are independent weight matrices. Each sampled signal is computed using learned weight matrices  associated with the key and query vectors.

[0058] The softmax operation is applied to the approximation of the expected value. In particular, the attention weights are computed using the following function:

[0059] FIG. 3A shows an example integral attention module with a sampling of four signals, corresponding to four separate query-key pairs. The query-key pairs are sampled from the logits distribution. This approach integrates the logits, i.e., attention scores, before applying the softmax operation. An attention mechanism, such as the Differential Transformer, that integrates after softmax operation may lead to over-smoothing. Averaging in the softmax domain may reduce the impact of the logits, effectively increasing temperature and leading to a flatter probability distribution. In contrast, the integral transformer preserves variance while reducing attention noise, thereby stabilizing training and enhancing model performance.

[0060] Moreover, selecting logits as signals ensures resilience against outliers. Since softmax maps input values onto a categorical probability distribution, averaging logits corresponds to computing a geometric mean in the probability space. Geometric means are known to be more robust against outliers compared to arithmetic means, making the integral transformer a theoretically sound approach for de-noising attention signals.

[0061] In operation 410, the computing system determines an attention output by computing a weighted sum of value vectors using the attention weights. The attention weights are applied to the value vector, by performing matrix multiplication of the softmax output with the value vector. The computing system then determines a next token of the output sequence based on the time step output (operation 412) . The output sequence is a series of generated or processed tokens produced as a result of the model’s computations.

[0062] In at least some implementations, the de-noising mechanism of the integral transformer is not applied to all transformer (self-attention) layers. Instead, de-noising may be selectively applied. The integral transformer may apply de-noising to the upper / terminal attention decoder layers while retaining vanilla self-attention in the lower / initial attention decoder layers. This approach leverages the observation that the initial layers benefit from local attention patterns, while deeper layers require noise reduction to prevent rank collapse and improve global context understanding. The attention decoder layers to which de-noising is applied may comprise a fixed number of terminal attention decoder layers in the first sequence. For example, half or 50%of the attention decoder layers in the first sequence may be integrated, i.e., de-noised. The attention decoder layers preceding these terminal attention decoder layers in the first sequence each performs standard self-attention on their respective layer inputs. In this way, the integral transformer leverages complementary strengths of both attention types, ensuring optimal knowledge retrieval and reasoning capabilities.

[0063] FIG. 5A illustrates an example computing system 500, which may be used to implement examples of the present disclosure, such as a generative AI system that employs a trained policy to select models for use in generating outputs through speculative decoding. Additionally, or alternatively, one or more instances of the example computing system 500 may be employed to execute the LLM. For example, a plurality of instances of the example computing system 500 may cooperate to provide output using an LLM in manners as discussed above.

[0064] The example computing system 500 includes at least one processing unit, such as a processor 502, and at least one physical memory 504. The processor 502 may be, for example, a central processing unit, a microprocessor, a digital signal processor, an application-specific integrated circuit (ASIC) , a field-programmable gate array (FPGA) , a dedicated logic circuitry, a dedicated artificial intelligence processor unit, a graphics processing unit (GPU) , a tensor processing unit (TPU) , a neural processing unit (NPU) , a hardware accelerator, or combinations thereof. The memory 504 may include a volatile or non-volatile memory (e.g., a flash memory, a random-access memory (RAM) , and / or a read-only memory (ROM) ) . The memory 504 may store instructions for execution by the processor 502, to the computing system 500 to carry out examples of the methods, functionalities, systems and modules disclosed herein.

[0065] The computing system 500 may also include at least one network interface 506 for wired and / or wireless communications with an external system and / or network (e.g., an intranet, the Internet, a P2P network, a WAN and / or a LAN) . A network interface may enable the computing system 500 to carry out communications (e.g., wireless communications) with systems external to the computing system 500, such as a language model residing on a remote system.

[0066] The computing system 500 may optionally include at least one input / output (I / O) interface 508, which may interface with optional input device (s) 510 and / or optional output device (s) 512. Input device (s) 510 may include, for example, buttons, a microphone, a touchscreen, a keyboard, etc. Output device (s) 512 may include, for example, a display, a speaker, etc. In this example, optional input device (s) 510 and optional output device (s) 512 are shown external to the computing system 500. In other examples, one or more of the input devices 510 and / or output device (s) 512 may be an internal component of the computing system 500.

[0067] Reference is made to FIG. 5B, which illustrates an example computing device 530. The computing device 530 is configured to deploy / implement hybrid ML models, such as the integral transformer models of the present disclosure. The components of the computing device 530 may collectively implement various optimization techniques for processing sequential data (e.g., LLMs using integral transformers) . The computing device 530 includes a communications engine 540, a computation engine 560, and a large language model engine 570.

[0068] The communications engine 540 may process inter-GPU communication. GPUs communicate with each other in order to efficiently distribute workloads, synchronize operations, and / or transfer data during computations. In the context of integral transformer models, computations may be parallelized across multiple GPUs for faster execution. For example, the communications engine 540 may execute inter-GPU communication processes which may run concurrently with one or more forward attention computations.

[0069] The computation engine 560 is configured to perform attention computations, such as self-attention. In particular, the computation engine 560 may execute the computations that are performed by the attention layers of an encoder and / or decoder. For the integral transformer of the present disclosure, the computation engine 560 may be configured to, at least, perform matrix multiplications, determine logit distributions, sample signals from probability distributions, and compute attention scores and weights.

[0070] Herein, use of language such as “at least one of X, Y, and Z, ” “at least one of X, Y, or Z, ” “at least one or more of X, Y, and Z, ” “at least one or more of X, Y, and / or Z, ” or “at least one of X, Y, and / or Z, ” is intended to be inclusive of both a single item (e.g., just X, or just Y, or just Z) and multiple items (e.g., {X and Y} , {X and Z} , {Y and Z} , or {X, Y, and Z} ) . The phrase “at least one of” and similar phrases are not intended to convey a requirement that each possible item must be present, although each possible item may be present.

[0071] In some implementations, the methods disclosed herein may be implemented as computer-executable instructions stored in one or more non-transitory computer-readable storage devices (in the form of software, firmware, or a combination thereof) such that, the instructions, when executed, may cause one or more physical components such as one or more circuits to perform the methods disclosed herein.

[0072] For example, in some implementations, an apparatus comprising one or more processors functionally connected to one or more non-transitory computer-readable storage devices or media may be used to perform the methods disclosed herein, wherein the one or more non-transitory computer-readable storage devices or media store the computer-executable instructions of the methods disclosed herein, and the one or more processors may read the computer-executable instructions from the one or more non-transitory computer-readable storage devices or media, and executes the instructions to perform the methods disclosed herein.

[0073] In some implementations, an apparatus may not have any processors or computer-readable storage devices or media. Rather, the apparatus may comprise any other suitable physical or virtual components for implementing the methods disclosed herein.

[0074] In some implementations, the computer-executable instructions that implement the methods disclosed herein may be one or more computer programs, one or more program products, or a combination thereof.

[0075] In some implementations, the methods disclosed herein may be implemented as one or more circuits, one or more components, one or more units, one or more modules, one or more integrated-circuit (IC) chips, one or more chipsets, one or more devices, one or more apparatuses, one or more systems, and / or the like.

[0076] The one or more circuits, one or more components, one or more units, one or more modules, one or more IC chips, one or more chipsets, one or more devices, one or more apparatuses, or one or more systems may be physical, virtual, or a combination thereof. Herein, the term “virtual” (such as a “virtual apparatus” ) refers to a circuit, component, unit, module, chipset, device, apparatus, system, or the like that is simulated or emulated or otherwise formed using suitable software or firmware such that it appears as if it is “real” or physical) .

[0077] The present disclosure encompasses various embodiments, including not only method embodiments, but also other embodiments such as apparatus embodiments and embodiments related to non-transitory computer readable storage media. Embodiments may incorporate, individually or in combinations, the features disclosed herein.

[0078] Although this disclosure refers to illustrative embodiments, this is not intended to be construed in a limiting sense. Various modifications and combinations of the illustrative embodiments, as well as other embodiments of the disclosure, will be apparent to persons skilled in the art upon reference to the description.

[0079] Features disclosed herein in the context of any particular embodiments may also or instead be implemented in other embodiments. Method embodiments, for example, may also or instead be implemented in apparatus, system, and / or computer program product embodiments. In addition, although embodiments are described primarily in the context of methods and apparatus, other implementations are also contemplated, as instructions stored on one or more non-transitory computer-readable media, for example. Such media could store programming or instructions to perform any of various methods consistent with the present disclosure.

[0080] Those skilled in the art will appreciate that the above-described embodiments and / or features thereof may be customized, separated, and / or combined as needed or desired. Moreover, although embodiments have been described above with reference to the accompanying drawings, those of skill in the art will appreciate that variations and modifications may be made without departing from the scope thereof as defined by the appended claims.

Claims

1.A computer-implemented method for generating an output sequence of tokens, the method comprising:receiving an input sequence of tokens;processing the input sequence using a decoder neural network that includes a first sequence of attention decoder layers, wherein the decoder neural network is configured to process the input sequence through the first sequence of attention decoder layers to generate a time step output and wherein each of one or more of the attention decoder layers is configured to:determine a logit distribution of the attention decoder layer by computing attention scores based on key and query vectors for the attention decoder layer;apply a softmax function to an average of the logit distribution of the attention decoder layer to obtain attention weights; anddetermine an attention output of the attention decoder layer by computing a weighted sum of value vectors using the attention weights; anddetermining a next token of the output sequence based on the time step output.2.The method of claim 1, wherein the average of the logit distribution comprises an expected value of the attention scores over a probability distribution.3.The method of claim 2, further comprising determining an approximation of the expected value using a defined number of signals sampled from the logit distribution, wherein the softmax function is applied to the approximation of the expected value.4.The method of any of claims 1 to 3, wherein each sampled signal is computed using learned weight matrices associated with the key and query vectors.5.The method of claim 1, wherein each of the one or more attention decoder layers is configured to implement multi-head attention.6.The method of any of claims 1 to 4, wherein the one or more attention decoder layers comprise a defined number of terminal attention decoder layers in the first sequence and wherein each attention decoder layer that precedes the terminal attention decoder layers in the first sequence performs self-attention on their respective layer inputs.7.The method of claim 6, wherein the defined number is half of a total number of attention decoder layers in the first sequence.8.A computing system for generating an output sequence of tokens from an input sequence of tokens, the computing system comprising:a processor; anda memory coupled to the processor, the memory storing computer-executable instructions that, when executed by the processor, configure the processor to perform the method of any one of claims 1 to 7.9.A non-transitory, computer-readable medium storing instructions that, when executed by a processor, configure the processor to perform the method of any one of claims 1 to 7.10.A device that is configured to perform the method of any one of claims 1 to 7.11.A processor that is configured to execute instructions to cause a device to perform the method of any one of claims 1 to 7.12.An integrated circuit that is configured to perform the method of any one of claims 1 to 7.13.A module comprising one or more circuits for performing the method of any one of claims 1 to 7.14.An apparatus comprising one or more processors functionally connected to a memory for performing the method of any one of claims 1 to 7.15.An apparatus that is configured to perform the method of any one of claims 1 to 7.16.A non-transitory, computer-readable storage media storing instructions that, when executed, cause at least one processing unit, at least one processor, or at least one circuit to perform the method of any one of claims 1 to 7.17.A computer program product including instructions that, when executed by an apparatus, enable the apparatus to implement the method of any one of claims 1 to 11.18.A computing system comprising a node for performing the method of any one of claims 1 to 7.