Methods and systems for subquadric complexity implicit attention in artificial neural networks

Implicitly calculating pairwise sequence attention scores with sub-quadratic complexity in transformer networks addresses scaling limitations, enhancing efficiency and performance in sequence tasks.

JP2024535897APending Publication Date: 2024-10-02APPL BRAIN RES INC
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
JP2024518239
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2021-09-20
Filing Date
2022-09-20
Publication Date
2024-10-02

AI Technical Summary

Technical Problem

Existing self-attention mechanisms in transformer neural networks face quadratic scaling limitations, restricting sequence length and underperforming in tasks requiring short-time scale dependencies.

Method used

Implicitly computing pairwise sequence attention scores using a preprocessing layer that reshapes input vectors into spatial-temporal matrices, followed by an implicit attention layer that calculates local attention scores, reducing computational complexity to sub-quadratic.

Benefits of technology

Improves learning efficiency and model performance in tasks like language processing and speech recognition by avoiding quadratic computational complexity, enabling processing of longer sequences and capturing short-time dependencies effectively.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024535897000001_ABST
    Figure 2024535897000001_ABST
Patent Text Reader

Abstract

A method and system for implicitly computing pairwise sequence attention scores in an artificial neural network with subquadric complexity is disclosed. Specifically, an "implicit attention" mechanism is disclosed that computes pairwise attention scores for the output of a neural network at each step of an input sequence, rather than across these steps. The implicit attention mechanism operates by taking the output vector already generated by the neural network layers for a given sequence step, and reshaping this vector into a matrix. The matrix is ​​transformed based on pairwise similarities between the rows and columns of the matrix. The result is an output vector that stores a compressed summary of all sequential dependencies present in the input sequence that are relevant to perform at least one classification, regression, or data generation task.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates generally to the field of sequential data processing by artificial neural networks, and more specifically to improving the local sequence processing capability and efficiency of these networks by implicitly computing pairwise sequence attention scores to model dependencies between different sequence elements in the context of data processing tasks. [Background technology]

[0002] One of the most important recent advances in machine learning involves the use of "self-attention" mechanisms in large-scale artificial neural networks. These mechanisms have been shown to dramatically improve the performance of neural network models in a wide range of sequential data processing tasks, and are therefore widely used in the domains of natural language processing, automatic speech recognition, and image generation. Given a sequence of input vectors, a self-attention mechanism computes, for every sequence position, a weighted average of the input vectors at every other sequence position, with weights proportional to the similarity scores (i.e., dot products) between these vectors. By computing all pairwise interactions between vectors in an input sequence, a neural network with self-attention can learn complex dependencies between items in this sequence, thus providing improved performance in a variety of regression, classification, and data generation tasks.

[0003] The most common implementation of self-attention is found in the "transformer" neural network model. Transformers stack multiple layers of self-attention blocks to create a network module that encodes inputs into latent representations and decodes these latent representations to perform various data processing tasks. Transformers usually do not contain recurrently connected layers, so the computations performed can be fully parallel and can be deployed on hardware accelerators such as GPUs (graphics processing units). The use of GPU-based acceleration allows the training of transformers on very large datasets, which has led to a qualitative and quantitative leap in performance, especially for language modeling tasks.

[0004] One drawback of transformer-based neural networks is that the calculation of attention scores scales quadratically with the length of the network's input sequence. In practice, this quadratic scaling limits the length of sequences that a transformer can process. A typical maximum is on the order of 1000 sequence elements. Another drawback is that while purely attention-based networks are effective at capturing long-range dependencies, they exhibit suboptimal performance in some problem domains (e.g., speech recognition) that have data dependencies that operate on relatively short time scales. Overall, efforts to exploit and improve the use of self-attention mechanisms in artificial neural networks have defined many systems for processing sequential data in the prior art. Thus, the following publications and patents are provided for their supporting teachings and are all incorporated by reference: Non-Patent Document 1 discloses the basic design of the self-attention mechanism and provides experimental evidence that it outperforms more traditional recurrent neural network models in the context of automatic language translation tasks.

[0005] Another prior art document, Non-Patent Document 2, discloses a mask-based training method for use with Transformer models. The document demonstrates that the training method leads to extremely high performance in natural language processing tasks such as sentiment analysis, semantic similarity assessment, and inference classification. BERT-style models are currently the de facto standard for most classification-based language processing tasks. ERT-style related models have been developed to achieve state-of-the-art results in other problem domains, including, for example, image classification and protein structure prediction. [Prior art documents] [Non-patent literature]

[0006]

Non-licensed literature 1

Non-licensed Document 2

Non-licensed Document 4

Non-licensed Document 5

[0007] Further prior art document, Non-Patent Document 3, discloses an autoregressive learning method for use with a transformer model that allows for generating extremely high quality natural language output in response to short text prompts. This learning method can be parallelized according to the architectural design of the self-attention mechanism, and can therefore be applied to large datasets of the order of hundreds of gigabytes, leading to a significant improvement in language generation quality. However, all of the techniques and systems described in the aforementioned document and many similar documents are subject to quadratic scaling in terms of computational complexity and memory usage for the length of the input sequence for a given system. More specifically, existing state-of-the-art technology offers little in the way of building self-attention mechanisms that maintain high quality model performance while achieving sub-quadratic complexity. [Means for solving the problem]

[0008] This application addresses these concerns and shortcomings by defining a method and system for implicitly computing pairwise sequence attention scores with sub-quadratic complexity in an artificial neural network. More specifically, this application discloses an "implicit attention" mechanism that computes pairwise attention scores on the outputs of a neural network at each step of an input sequence, rather than across steps of the input sequence. To compute the attention scores locally step-by-step, the implicit attention mechanism is used in tandem with a neural network layer whose outputs at each time step can be separated into a two-dimensional matrix with spatial and temporal axes. Then, the pairwise attention scores for the spatial axis are computed using row vectors corresponding to the time axis of the matrix. A new set of spatial representations is then created that is a weighted average of these row vectors. These spatial representations are projected into the same dimensions as the input to the neural network at a given time step, providing a clean transformation from a sequence of n d-dimensional input vectors to a sequence of n d-dimensional output vectors. Various neural network models use linear recurrent and convolutional layers to generate matrices with spatial and temporal axes at each time step, and the overall computational complexity of these models is linear or log-linear, rather than quadratic. This computational complexity significantly improves the learning efficiency and model performance in various automatic language processing and speech recognition tasks.

[0009] In view of the aforementioned limitations inherent in known methods for implementing self-attention mechanisms in artificial neural networks, the present invention provides a method and system for implicitly computing pairwise sequence attention scores with sub-quadratic complexity in artificial neural networks. These methods and systems comprise the use of neural network layers that process a sequence of input vectors to produce as output, for every vector in the sequence, a matrix whose axes correspond to the spatial and temporal components of the information in the input sequence. The attention scores are computed over the temporal components of this matrix, thereby performing an implicit version of attention on the original items of the input sequence. The attention mechanism is implicit because the attention scores are computed over a local representation of the history of the sequence, and not over the items of the sequence themselves (as in standard attention mechanisms). The output of this implicit attention mechanism is projected to the dimensions of the input vector before being passed to a subsequent neural network layer for the purpose of performing at least one regression, classification, or data generation task. Most importantly, all attention scores are computed locally for each step of the input sequence, so that pairwise computations across all sequence steps are not performed, thereby avoiding the need for quadratic computational complexity.Thus, it is a general object of the present invention, which is described in more detail below, to provide a method and system for implicitly computing pairwise sequence attention scores in an artificial neural network with less than quadratic complexity.

[0010] A main aspect of the invention is to define a method and system for implicitly computing pairwise sequence attention scores in an artificial neural network with subquadratic complexity. The method comprises defining at least one preprocessing layer that takes in a sequence of input vectors and generates for each input vector an output vector that is reshaped into a matrix with one dimension corresponding to spatial information and the other dimension corresponding to temporal information. The preprocessing layer implements either a linear recurrent neural network, a nonlinear recurrent neural network, or a convolutional neural network. The method further comprises defining at least one "implicit attention" layer that processes the output matrix of the at least one preprocessing layer in the following way: two (or three) copies of the output matrix are made. Each copy is then multiplied on the right by two learning matrices to generate two intermediate matrices. These intermediate matrices are then multiplied together to form a square matrix whose elements represent the pairwise similarities between all rows of the intermediate matrix. These pairwise similarities are then used to create the new output matrix by providing weights on the basis to determine the rows of the new matrix. The new matrix is ​​passed to zero or more additional neural network layers to provide a final output vector. Finally, the method discloses operating the resulting artificial neural network by mapping a number of input vectors to a number of output vectors to perform at least one of the following tasks: pattern classification, signal processing, data representation, or data generation.

[0011] In this regard, before describing at least one embodiment of the invention in detail, it is to be understood that the invention is not limited in its application to the details of construction and the arrangement of components set forth in the following description or illustrated in the drawings. The invention is capable of other embodiments and of being practiced and carried out in various ways. Also, it is to be understood that the phraseology and terminology used herein is for the purpose of description and should not be regarded as limiting.

[0012] These, together with other objects of the invention, as well as the various features of novelty which characterize it, are particularly pointed out in this disclosure. For a better understanding of the invention, its operating advantages, and the specific objects attained by its uses, reference should be made to the accompanying drawings and descriptive matter in which a preferred embodiment of the invention is illustrated.

[0013] The invention will be better understood, and further objects thereof will become apparent, from a consideration of the following detailed description, which refers to the accompanying drawings, in which: [Brief description of the drawings]

[0014] [Figure 1] FIG. 1 is an illustration of an artificial neural network model architecture that implements the disclosed implicit attention mechanism. [Diagram 2] FIG. 13 illustrates the improvement in neural network model performance observed when using the disclosed implicit attention mechanism. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0015] In the following detailed description, reference is made to the accompanying drawings, which form a part hereof, and which show, by way of illustration, specific embodiments in which the present invention may be practiced. These embodiments are described in sufficient detail to enable those skilled in the art to practice the invention, and it is understood that the embodiments may be combined and utilized with other embodiments, and structural and logical changes may be made without departing from the spirit and scope of the present invention. Therefore, the following detailed description is not to be taken in a limiting sense, and the scope of the present invention is defined by the appended claims and their equivalents.

[0016] The present invention will now be briefly described with reference to the accompanying drawings, in which: Reference will now be made in more detail to the exemplary drawings for the purposes of illustrating non-limiting embodiments of the present invention. As used herein, the term "comprising" and its derivatives including "comprises" and "comprise" include each listed integer or element but do not exclude the inclusion of one or more further integers or elements.

[0017] As used herein, the singular forms "a," "an," and "the" include plural references unless the context clearly dictates otherwise. For example, reference to "an apparatus" includes not only a single apparatus, but two or more apparatus, and so forth.

[0018] As used herein, the terms "for example," "like," "such as," or "comprising" are meant to introduce examples that further clarify a more general subject matter. Unless otherwise specified, these examples are provided only as an aid in understanding the applications illustrated in this disclosure and are not intended to be limiting in any manner.

[0019] As used herein, the terms "may," "can," "potential," or "could" do not require that the particular component or feature be included or have that feature.

[0020] Exemplary embodiments will now be described in more detail with reference to the accompanying drawings, in which exemplary embodiments are shown. These exemplary embodiments are provided for illustrative purposes only, so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art. However, the disclosed invention may be embodied in many different forms and should not be construed as being limited to the embodiments set forth herein.

[0021] Various modifications will be readily apparent to those skilled in the art. The general principles defined herein may be applied to other embodiments and applications without departing from the spirit and scope of the present invention. Moreover, all statements herein describing embodiments of the present invention, and specific examples thereof, are intended to encompass both structural and functional equivalents thereof. Moreover, such equivalents are intended to include both currently known equivalents as well as equivalents developed in the future (i.e., any element that performs the same function, regardless of structure, is developed). Additionally, the terms and phrases used are for the purpose of describing exemplary embodiments and should not be considered limiting. Thus, the present invention is accorded the widest scope encompassing numerous alternatives, modifications, and equivalents consistent with the principles and features disclosed. For clarity, details regarding technical materials known in the art related to the present invention have not been described in detail so as not to unnecessarily obscure the present invention.

[0022] Thus, for example, those skilled in the art will appreciate that the figures, schematics, illustrations, and the like represent conceptual diagrams or processes illustrating systems and methods embodying the present invention. The functionality of the various elements shown in the figures may be provided through the use of dedicated hardware as well as hardware capable of executing associated software. Similarly, the switches shown in the figures are conceptual. Their functionality may be performed through the operation of program logic, through dedicated logic, through the interaction of program control and dedicated logic, or manually, with the particular technique being selectable by the entity implementing the invention. Those skilled in the art will further appreciate that the exemplary hardware, software, processes, methods, and / or operating systems described herein are for purposes of illustration and thus are not intended to be limited to the specifically named elements.

[0023] Each of the appended claims defines a separate invention and is recognized for infringement purposes to include equivalents to the various elements or limitations specified in the claims. Depending on the context, all references below to "the present invention" may in some cases refer only to certain specific embodiments. In other cases, it will be recognized that references to "the present invention" refer to subject matter recited in one or more, but not necessarily all, of the claims.

[0024] All methods described herein may be performed in any suitable order unless otherwise indicated herein or clearly contradicted by context. Any examples provided herein with respect to specific embodiments, or the use of exemplary language (e.g., "such as"), are intended merely to better illuminate the invention and do not pose limitations on the scope of the otherwise claimed invention. No language in the specification should be construed as indicating any non-claimed element essential to the practice of the invention.

[0025] Various terms used in this specification are set forth below. To the extent a term used in the claims is not defined below, it should be given the broadest definition that one of ordinary skill in the art would give to that term, as reflected in the printed publications and issued patents at the time of filing.

[0026] Groupings of alternative elements or embodiments of the invention disclosed herein are not to be construed as limitations. Each group member may be referenced and claimed individually or in any combination with other members of the group or other elements found herein. One or more members of a group may be included in or deleted from a group for reasons of convenience and / or patentability. When such inclusions or deletions are made, the specification shall be deemed to include the group as modified to satisfy all group descriptions used in the appended claims.

[0027] For simplicity and clarity of description, numerous specific details are set forth in order to provide a thorough understanding of the exemplary embodiments described herein. However, it will be understood by those skilled in the art that the embodiments described herein may be practiced without these specific details. In other instances, well-known methods, procedures, and components have not been described in detail so as not to obscure the embodiments generally described herein.

[0028] Furthermore, this specification is not intended to limit the scope of the embodiments described herein in any way, but rather to merely illustrate implementations of various embodiments as described.

[0029] The embodiments of the artificial neural network described herein may be implemented in configurable hardware (i.e., FPGAs) or custom hardware (i.e., ASICs), or a combination of both with at least one interface. Input signals are consumed by the digital circuitry to perform the functions described herein and to generate output signals. The output signals are provided to one or more adjacent or surrounding systems or devices in a known manner.

[0030] As used herein, the term "node" in the context of artificial neural networks refers to a basic processing element that implements the functionality of a simulated "neuron," which may be a spiking neuron, a continuous rate neuron, or any linear or nonlinear component used to construct a distributed system.

[0031] The described system can be implemented using adaptive or non-adaptive components, and can be implemented efficiently on a wide variety of distributed systems with many non-linear components whose individual outputs can be combined together to implement particular aspects of the system, as described in more detail herein below.

[0032] The main embodiment of the present invention is a set of methods and systems for implicitly computing pairwise sequence attention scores with sub-quadratic complexity in an artificial neural network. The method comprises defining at least one preprocessing layer that takes a sequence of input vectors, where the preprocessing layer generates an output vector for each input vector that is reshaped into a matrix with one dimension corresponding to spatial information and the other dimension corresponding to temporal information. The preprocessing layer implements either a linear recurrent neural network, a non-linear recurrent neural network, or a convolutional neural network. The method further comprises defining at least one "implicit attention" layer that processes the output matrix of the at least one preprocessing layer, i.e., the "implicit attention" layer creates two (or three) copies of the output matrix and multiplies each copy by two learned matrices on the right to generate two intermediate matrices. These intermediate matrices are multiplied together to form a square matrix: Each element of this square matrix represents the pairwise similarity between all rows of the intermediate matrix. These pairwise similarities are then used to create a new output matrix by providing weights on the basis to determine the rows of the new matrix. This new output matrix is ​​passed to zero or more additional neural network layers to provide a final output vector. Finally, the method discloses operating the resulting artificial neural network to perform at least one pattern classification, signal processing, data representation, or data generation task by mapping a number of input vectors to a number of output vectors.

[0033] The term "attention mechanism" here refers to a neural network module that takes in a sequence of n d-dimensional input vectors (i.e., an n×d matrix) and multiplies them by a "query" matrix and a "key" matrix. The outputs of these matrix multiplications are multiplied by themselves to generate an n×n "attention" matrix that scores the pairwise similarity between each vector in the input sequences. The attention matrix is ​​then multiplied by an n×d "value" matrix to generate a sequence of n d-dimensional output vectors. The term "self-attention", as just mentioned, refers to an attention mechanism that computes pairwise attention scores between items in a single input sequence. Other attention mechanisms compute attention scores between pairs of items already drawn from separate sequences.

[0034] The term "implicit attention" here refers to an attention mechanism that uses each item in a sequence of input vectors to compute pairwise similarity scores across rows or columns of a matrix generated by a neural network layer. Implicit attention thus operates on a local matrix corresponding to a single step in the input sequence of the neural network, rather than a global matrix corresponding to all steps in the input sequence. Generally, linear projections are used to keep the results of these local matrix transformations low-dimensional. Thus, the overall computational complexity of implicit attention is reduced compared to standard self-attention.

[0035] The term "multi-headed self-attention" here refers to a self-attention mechanism that uses a single matrix of n d-dimensional input vectors to compute the output of multiple "key", "query", and "value" parameter matrices in parallel. Each triplet of these key, query, and value matrices defines an "attention head" that learns to model a different set of dependencies between items in the input sequence. Adding multiple attention heads to a neural network model with an attention mechanism increases its expressive power accordingly, and therefore its ability to learn more complex mappings between sequences of input data and target output values.

[0036] The term "recurrent connections" refers to a set of weighted connections that return the output of one or more nodes of a given network layer as input to one or more nodes of the same layer. The term "recurrently connected artificial neural network" refers to a neural network with one or more recurrent connections. Recurrent connections typically introduce a sequential bottleneck in computing the output value of a layer from a sequence of inputs, because the activation value at a given point in the sequence depends on the values ​​computed for all previous steps in the sequence. Alleviating this sequential bottleneck is necessary to fully exploit specialized hardware devices such as GPUs. GPUs speed up neural network computations by parallelizing the computations across a large number of relatively simple processing elements.

[0037] The term "activation function" refers to any method or algorithm for applying a linear or nonlinear transformation to some input values ​​to generate output values ​​in an artificial neural network. Examples of activation functions include identity function, ReLU function, leaky ReLU function, threshold ReLU function, parametric ReLU function, sigmoid function, tanh function, softmax function, log softmax function, maxpool function, polynomial function, sine function, gamma function, softsine function, heavyside function, swish function, exponential linear function, scaled exponential linear function, and Gaussian error linear function. The term "linear network layer" refers to any layer in an artificial neural network that uses a linear activation function, such as the identity function, to calculate output values.

[0038] The activation function may optionally output a "spike" (i.e., a single-bit event), a "multi-valued spike" (i.e., a multi-bit event having a fixed or floating bit-width), a continuous quantity (i.e., a floating-point value (typically 16-bit, 32-bit, or 64-bit) having a level of precision determined by a given computing system), or a complex value (i.e., a pair of floating-point numbers representing rectangular or polar coordinates). These aforementioned functions are commonly referred to by those skilled in the art as "spiking", "multi-bit spiking", "non-spiking", and "complex-valued" neurons, respectively. When using spiking neurons, the real and complex values ​​may also be represented by any of a number of encoding and decoding schemes comprising the relative timing of the spikes, the frequency of the spikes, and the phase of the spikes. However, it will be understood by those skilled in the art that the embodiments described herein may be practiced without these specific details.

[0039] The term "convolution" here refers to a mathematical operation that takes two functions as input, inverts one of the functions, and then produces as output a third function that is evaluated as the integral of the product of the two input functions over all possible shifts of the inverted function. In many signal processing applications, the input functions are functions of time, so the integral is over the product of these functions evaluated accordingly in the "time domain". It is also possible to perform convolution when the functions are represented as a weighted combination of more fundamental signal frequencies. In this "frequency domain" representation of the input functions, convolution is simply defined as an element-wise product.

[0040] The term "loss metric" herein refers to a scalar output value that is minimized by an artificial neural network computation. Examples of loss metrics include mean squared error (MSE), cross entropy loss (categorical or binary), Kullback-Leibler divergence, cosine similarity, and hinge loss. A loss metric is computed using a loss function that generates a metric from one or more inputs. These inputs consist of externally provided data, outputs computed by nodes in the artificial neural network, supervisory and reward signals, the state of the dynamic system, or any combination thereof.

[0041] The nonlinear components of the aforementioned system can be implemented using a combination of adaptive and non-adaptive components. Examples of nonlinear components that may be used in various embodiments described herein include simulated / artificial neurons, FPGAs, GPUs, and other parallel computing systems. The components of the system can be implemented using various standard technologies, such as using a microcontroller. Furthermore, the nonlinear components can be implemented in various forms, including software simulation, hardware, or any neuronal fabric. The nonlinear components can also be implemented using neuromorphic computing devices, such as Neurogrid, SpiNNaker, Loihi, TrueNorth, and the like.

[0042] As an exemplary embodiment of the proposed system and method, consider the neural network model shown diagrammatically in Fig. 1. The network is composed of two high-level modules. The first of these modules, ������������������������������, accepts as input a sequence of 'd'-dimensional vectors, {x 1 ,x 2 ,x n} and outputs another sequence of vectors {y 1 ,y 2 ,···,y m}, where each y is a vector that can be reshaped into a matrix with time and space axes. Any neural network layer that can be configured to output a set of vectors, where each vector in the set can be reshaped into a matrix {circumflex over (x)} with one dimension corresponding to time information and the other dimension corresponding to spatial information, can be used as this first module. A non-exhaustive list of types of neural network layers that can be used to implement this first module includes:

[0043] Nonlinear Recurrent Neural Networks (RNNs): Consider a nonlinear RNN, such as a standard long short-term memory network (LSTM), with q units and configured to accept 1-dimensional sequences as input. Given a sequence of input vectors {x 1 ,x 2 ,…,x n} one dimension at a time, i.e., {x i 1 ,x i 2 ,…,x i n} into LSTM, the output is {y i 1 ,y i 2 ,…,y i m}, where each vector has “q” elements. Since the input is d-dimensional, these sequences exist in d numbers. Therefore, at each time step, we stack d of these outputs to create a storage matrix M of size q×d. t We form a matrix whose first dimension contains spatial information while the second contains time information. The same procedure can be repeated for other nonlinear recurrent neural network types. Furthermore, instead of using a single RNN, we can use a stack of RNNs to compute the output state. For example, 1 ,RNN 2 ,…,RNN d We use RNNs for the number of input dimensions, d, so that we have d = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 6 t can be constructed.

[0044] Linear RNN: The matrix M can be obtained by using a linear RNN or a stack of linear RNNs as in the above case. The weights inside the RNN can be randomly initialized or selected from a set of discrete or continuous Legendre (transformation using Legendre polynomials), Fourier, Hadamard, Haar, Laplace, cosine, Fourier-Stieltjes, Gelfand, or Hartley transforms. Initializing the weights to one of the above basis functions, as well as freezing them during training, can lead to significant speedups in training, since the computation of linear RNNs can be parallelized during training (Non-Patent Document 4). In Figure 1, a linear recurrent neural network called a Legendre Memory Unit or LMU

[0102] is used as part of the exemplary embodiment (Non-Patent Document 5).

[0045] 1D convolution: A 1D convolution layer or a stack of them can be applied to the input dimensions separately to obtain a matrix M. For example, using q filters in each convolution layer, we obtain a matrix M of shape q×d at each time step, similar to the RNN case. t can be constructed.

[0046] The second module implements implicit self-attention on the matrix M already generated by the first module for each item of the input sequence. This implicit self-attention mechanism operates locally on the matrix already computed for each item of the input sequence. Thus, the implicit self-attention mechanism does not operate directly on the input sequence, but rather on the matrix M t It operates on a compressed representation of this sequence's history at each step, in the form: Ignoring optional network features such as bias vectors, normalization layers, and skip connections, the implicit attention module simultaneously computes the following operations:

[0047]

number

[0048] Here, R i is R d×d σ can be nonlinear, such as a gel or an identity function. Thus, the resulting matrices Q, K, and V are all in R. q×d Then, if it is deemed useful to change the time dimension from q to q', with q>q', then the following operations can be performed on the three matrices:

[0049]

number

[0050] Here, L i is R q′×q The resulting matrices Q, K, and V are all in R. q′×d By making such reductions, the overall parameter efficiency of the neural network model can be improved significantly.

[0051] Matrices Q, K, and V are then passed to a conventional self-attention computation as shown below.

[0052]

number

[0053] Here, the attention matrix Q t K T t has dimensions q'×q'. Next, the following calculations are performed to output a d-dimensional vector:

[0054]

number

[0055] where p is R 1×q m is in R d Note that if q′ is set to 1 in the above step, this step can be omitted. Overall, considering that the input to the exemplary embodiment is d-dimensional and the output after application of implicit attention is also d-dimensional, the underlying neural network computes a straight forward attention-based transformation on the input sequence. This transformation can be used to perform downstream regression, classification, or data generation tasks. Standard training methods for optimizing neural networks can also be used to improve performance on these tasks, utilizing any loss function.

[0056] To provide a demonstration of the use of the disclosed method and system for implicitly computing pairwise sequence attention scores at sub-quadratic complexity in artificial neural networks, results from a number of benchmark experiments are described herein. These experiments use a legend memory unit and an implicit attention module to perform an autoregressive language modeling task. The model is trained on a publicly available internet text dataset called OpenWebText2, which is comprised of approximately 8 billion tokens or words after preprocessing. The goal of language modeling is to accurately predict the next word in a sequence of text given a number of preceding words. With reference to FIG. 2, the loss metric is a numerical measure of performance for this task (lower loss indicates better performance). Similar to well-known scaling results from the literature on transformer-based natural language processing (NPL 6), the performance of the model follows a power law of loss as a function of the number of parameters. Importantly, the fit of this power law to the LMU

[0203] model with both standard and implicit attention is substantially downward shifted compared to the fits of the Transformer

[0202] and LSTM

[0201] models. This substantial downward shift indicates that the LMU model achieves substantially higher accuracy for a given number of model parameters. The modified LMU model with standard self-attention achieves the best level of overall accuracy

[0204] .

[0057] It should be understood that the above description is intended to be illustrative, and not restrictive. For example, the above-described embodiments can be used in combination with each other. Many other embodiments will be apparent to those of ordinary skill in the art upon reviewing the above description.

[0058] The benefits and advantages that may be provided by the present invention have been described above with respect to specific embodiments. These benefits and advantages, and the elements or limitations that may cause them to occur or make them more pronounced, are not to be construed as key, essential, or required features of any or all of the embodiments.

[0059] Although the present invention has been described with reference to specific embodiments, it should be understood that the embodiments are illustrative and that the scope of the present invention is not limited to these embodiments. Many variations, modifications, additions, and improvements to the above-described embodiments are possible. These variations, modifications, additions, and improvements are intended to be within the scope of the present invention.

Claims

1. 1. A computer-implemented method for sequence processing in an artificial neural network model, the method comprising: a. defining at least one pre-processing layer, the at least one pre-processing layer receiving an input sequence of vectors to generate three output vectors for each input vector and reshaping each of the output vectors into an output matrix, one dimension of the output matrix corresponding to spatial information in the input sequence and another dimension of the output matrix corresponding to temporal information in the input sequence, the pre-processing layer comprising: a-i. A nonlinear recurrent neural network (RNN), or a stack of nonlinear RNNs; and a-ii. A linear RNN or a stack of linear RNNs with a fixed linear regression transformation; a-iii. A convolutional layer, in which the convolution operations have fixed or learned weights; or a-iv. A convolution layer implementing the linear system by using the impulse response of the linear system with the input vector in the Fourier domain; said step of defining at least one pre-treatment layer, b. defining at least one implicit attention layer, the at least one implicit attention layer comprising: bi. taking dot products between every pair of rows in the first two output matrices to compute an attention score that models dependencies between row or column vectors in the output matrices that represent temporal information from the original input sequence; and b-ii. multiplying the obtained attention scores by a third output matrix to compute a final output vector that stores a compressed summary of all previous items in the input sequence; defining at least one implicit attention layer that processes the three reshaped output vectors into the three output matrices of at least one preprocessing layer by c) operating the resulting artificial neural network by using the artificial neural network to map a sequence of the input vectors onto at least one of the final output vectors to perform at least one task selected from the group consisting of pattern classification, signal processing, data representation, and data generation; The method comprises:

2. The linear regression transformation of step a-ii is randomly initialized; The method of claim 1.

3. said linear regression transform in step a-ii is selected from the set of: discrete or continuous Legendre transform, Fourier transform, Hadamard transform, Haar transform, Laplace transform, cosine transform, Fourier-Stieltz transform, Gerfann transform, or Harley transform, The method of claim 1.

4. Any of steps a and b is followed by a nonlinearity. The method of claim 1.

5. The method further comprises one or more skip connections that pass neural network activity from one network layer to another downstream network layer while skipping one or more intermediate layers. The method of claim 1.

6. the single output matrix is ​​generated by the preprocessing layer; The three copies of the output matrix are linearly or nonlinearly transformed before being provided as input to the implicit attention layer. The method of claim 1.

7. Three copies of the input sequence of vectors are provided as input to the preprocessing layer. The method of claim 1.

8. A separate pre-processing layer is used to create each of the three output matrices. The method of claim 1.

9. The input sequence of vectors is passed through three independent linear or non-linear transformations before being provided as input to the preprocessing layer. The method of claim 1.

10. a first output matrix of the output matrices of the pre-processing layer has a time dimension of length “1”; The method of claim 1.

11. 1. A system for pattern classification, signal processing, data representation, or data generation in a neural network, the system comprising: at least one pre-processing layer, the at least one pre-processing layer receiving an input sequence of vectors to generate three output vectors for each input vector and reshaping each of the output vectors into an output matrix, one dimension of the output matrix corresponding to spatial information in the input sequence and another dimension of the output matrix corresponding to temporal information in the input sequence, the pre-processing layer comprising: a-i. A nonlinear recurrent neural network (RNN), or a stack of nonlinear RNNs; and a-ii. A linear RNN or a stack of linear RNNs with a fixed linear regression transformation; a-iii. A convolutional layer, in which the convolution operations have fixed or learned weights; or a-iv. A convolution layer that implements the linear system by using the impulse response of the linear system with the input vector in the Fourier domain; At least one pretreatment layer implemented in at least one of b. at least one implicit attention layer, the at least one implicit attention layer comprising: bi. taking dot products between every pair of rows in the first two output matrices to compute an attention score that models dependencies between row or column vectors in the output matrices that represent temporal information from the original input sequence; and b-ii. multiplying the obtained attention scores by a third output matrix to compute a final output vector that stores a compressed summary of all previous items in the input sequence; at least one implicit attention layer that processes the three reshaped output vectors into the three output matrices of the at least one preprocessing layer by Equipped with the system operates the neural network to map the sequence of input vectors to at least one final output vector to perform at least one task selected from the group consisting of pattern classification, signal processing, data representation, and data generation; system.

Citation Information

Patent Citations

  • Extending Attention-Based Neural Networks to Selectively Attend to Past Inputs

    JP2022549893A