Generating sequences of data elements using cross attention operations
By combining cross-attention and self-attention operations in the neural network, the problem of high computational complexity in traditional models when processing lengthy sequences of data elements is solved, and the ability to efficiently generate long sequences of data elements is achieved.
Patent Information
- Application Number
- CN202380019041.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2022-01-28
- Filing Date
- 2023-01-27
- Publication Date
- 2024-09-06
AI Technical Summary
It is difficult for existing technologies to efficiently generate very long sequences of data elements, such as high-resolution images and videos, and traditional neural networks have high computational complexity and are difficult to expand when processing lengthy sequences of data elements.
A neural network model using cross-attention and self-attention operations updates the latent embedding using the attention on the current sequence of data element embeddings through the cross-attention block, and uses the self-attention block to share information on the latent embedding sequence to generate data Sequence of elements.
It significantly reduces the consumption of computing resources, can effectively generate very long sequences of data elements, such as millions of data elements, and the computational complexity has nothing to do with the length of data element embedding, achieving efficient encoding of complex remote patterns.
Smart Images

Figure CN118613804A
Abstract
Description
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims the benefit of the filing date of U.S. Provisional Patent Application Serial No. 63 / 304,373, filed on January 28, 2022, entitled “GENERATING SEQUENCES OF DATAELEMENTS USING CROSS-ATTENTION OPERATIONS,” the entire contents of which are incorporated herein by reference. Background Art
[0003] This specification relates to using machine learning models to process data.
[0004] A machine learning model receives an input and generates an output, such as a predicted output, based on the received input. Some machine learning models are parametric models and generate an output based on the received input and parameter values of the model.
[0005] Some machine learning models are deep models that employ multi-layer models to generate outputs for received inputs. For example, a deep neural network is a deep machine learning model that includes an output layer and one or more hidden layers that apply non-linear transformations to received inputs to generate outputs. Summary of the invention
[0006] This specification generally describes a system, implemented as a computer program on one or more computers in one or more locations, that can generate a sequence of data elements using a neural network.
[0007] Throughout this specification, an embedding refers to an ordered collection of values, such as a vector or matrix of values.
[0008] A block is a group of one or more neural network layers in a neural network.
[0009] According to a first aspect, a method is provided, comprising: generating a sequence of data elements, the sequence of data elements including a corresponding data element at each position in a sequence of positions, and for each position after a first position in the sequence of positions, comprising: obtaining a current sequence of data element embeddings, the current sequence of data element embeddings including a corresponding data element embedding for each data element at a position preceding the current position; obtaining a latent embedding sequence; and processing, using a neural network: (i) the current sequence of data element embeddings, and (ii) the latent embedding sequence to generate a data element at the current position.
[0010] The neural network can include a sequence of neural network blocks, the sequence of neural network blocks including: (i) a criss-cross attention block, (ii) one or more self-attention blocks, and (iii) an output block. The criss-cross attention block performs an operation comprising: updating each potential embedding in a sequence of potential embeddings using attention on a current sequence of data element embeddings. Each self-attention block performs an operation comprising: updating each potential embedding in a sequence of potential embeddings using attention on a sequence of potential embeddings. The output block performs an operation comprising: processing one or more potential embeddings from the sequence of potential embeddings to generate a data element at a current position after updating the sequence of potential embeddings using the criss-cross attention block and the one or more self-attention blocks.
[0011] In some implementations, updating each potential embedding in the sequence of potential embeddings using attention on the current sequence of data element embeddings includes updating each potential embedding in the sequence of potential embeddings using masked attention on the current sequence of data element embeddings.
[0012] In some embodiments, each potential embedding corresponds to a corresponding position in a sequence of positions, and wherein, for each potential embedding, updating each potential embedding in the sequence of potential embeddings using masked attention on a current sequence of data element embeddings comprises updating the potential embedding using attention only: (i) on the data element embedding at the position corresponding to the potential embedding, and (ii) on any data element embeddings at positions prior to the position corresponding to the potential embedding.
[0013] In some implementations, updating each potential embedding in the sequence of potential embeddings using attention over the sequence of potential embeddings includes updating each potential embedding in the sequence of potential embeddings using masked attention over the sequence of potential embeddings.
[0014] In some embodiments, for each potential embedding in the sequence of potential embeddings, updating each potential embedding in the sequence of potential embeddings using masked attention over the sequence of potential embeddings includes updating the potential embedding using attention over only: (i) the potential embedding, and (ii) any potential embedding that precedes the potential embedding in the sequence of potential embeddings.
[0015] In some implementations, for one or more positions in the position sequence, obtaining a potential embedding sequence includes: identifying a subsequence of a current sequence in which data elements are embedded; and determining the potential embedding sequence based on the subsequence of the current sequence in which data elements are embedded.
[0016] In some embodiments, the subsequence of the current sequence of data element embeddings includes a predefined number of last data element embeddings in the sequence of data element embeddings.
[0017] In some implementations, determining the potential embedding sequence based on a subsequence of a current sequence in which data elements are embedded includes setting the potential embedding sequence equal to the subsequence of the current sequence in which data elements are embedded.
[0018] In some implementations, generating a data element at a current position includes: processing one or more potential embeddings from a sequence of potential embeddings to generate a score distribution over a set of possible data elements; and selecting the data element at the current position using the score distribution over the set of possible data elements.
[0019] In some implementations, selecting the data element at the current position using a score distribution over the set of possible data elements includes sampling the data element at the current position from the set of possible data elements according to the score distribution over the set of possible data elements.
[0020] In some implementations, for each position of the one or more positions in the sequence of positions: the number of potential embeddings in the sequence of potential embeddings is less than the number of data element embeddings in the current sequence of data element embeddings.
[0021] In some implementations, the number of potential embeddings is at least an order of magnitude smaller than the number of data element embeddings.
[0022] In some embodiments, for each position after the first position in the sequence of positions, the number of potential embeddings in the sequence of potential embeddings is predefined and independent of the number of data element embeddings in the current sequence of data element embeddings.
[0023] In some implementations, generating the sequence of data elements includes autoregressively generating the sequence of data elements.
[0024] In some embodiments, a sequence of data elements defines an image.
[0025] In some implementations, the sequence of data elements defines an audio waveform.
[0026] In some implementations, the sequence of data elements defines a sequence of notes.
[0027] In some embodiments, a sequence of data elements defines the structure of a protein.
[0028] In some implementations, a sequence of data elements defines a video.
[0029] According to a second aspect, a method is provided, comprising: obtaining a representation of a sequence of data elements as a sequence of data element embeddings, the data element embedding sequence comprising a corresponding data element at each input position in a sequence of input positions; obtaining a sequence of latent embeddings, wherein each latent embedding corresponds to a corresponding position in the sequence of input positions; and processing: (i) the sequence of data element embeddings, and (ii) the sequence of latent embeddings using a neural network to generate a corresponding network output for each output position in a sequence of output positions. The neural network comprises a sequence of neural network blocks, the sequence of neural network blocks comprising: (i) a cross-attention block, (ii) one or more self-attention blocks, and (iii) an output block.
[0030] The criss-cross attention block performs an operation comprising: updating each latent embedding in the sequence of latent embeddings using masked attention on the sequence of data element embeddings. Each self-attention block performs an operation comprising: updating each latent embedding in the sequence of latent embeddings using masked attention on the sequence of latent embeddings. The output block performs an operation comprising, after updating the sequence of latent embeddings using the criss-cross attention block and one or more self-attention blocks: for each output position in the sequence of output positions, generating a network output for the output position by processing the corresponding latent embedding from the sequence of latent embeddings.
[0031] In some embodiments, for each potential embedding in the sequence of potential embeddings, updating each potential embedding in the sequence of potential embeddings using masked attention on the sequence of data element embeddings includes: updating the potential embedding using attention only on: (i) the data element embedding at the input position corresponding to the potential embedding, and (ii) any data element embedding at the input position prior to the input position corresponding to the potential embedding.
[0032] In some embodiments, for each potential embedding in the sequence of potential embeddings, updating each potential embedding in the sequence of potential embeddings using masked attention over the sequence of potential embeddings includes updating the potential embedding using attention over only: (i) the potential embedding, and (ii) any potential embedding that precedes the potential embedding in the sequence of potential embeddings.
[0033] In some implementations, for each potential embedding, obtaining the sequence of potential embeddings includes determining the potential embedding based on a data element embedding at an input position corresponding to the potential embedding.
[0034] In some implementations, determining the potential embedding based on the data element embedding at the input position corresponding to the potential embedding includes setting the potential embedding equal to the data element embedding at the input position corresponding to the potential embedding.
[0035] In some implementations, for each output position in the sequence of output positions, the network output for the output position includes a distribution of scores over a set of possible data elements.
[0036] In some implementations, the method further includes: determining a gradient of the objective function with respect to a set of neural network parameters of the neural network; and using the gradient to update a current value of the set of neural network parameters of the neural network.
[0037] In some implementations, for each output position in the sequence of output positions, the objective function measures the error between (i) a distribution of scores over a set of possible data elements at the output position and (ii) a target data element for the output position.
[0038] In some embodiments, the error comprises a cross entropy error.
[0039] In some embodiments, for each output position before the last output position in a sequence of output positions, the target data element for the output position is the data element at the next input position in the sequence of data elements after the input position corresponding to the latent embedding that was processed to generate the score distribution at the output position.
[0040] According to a third aspect, a system is provided, comprising: one or more computers; and one or more storage devices communicatively coupled to the one or more computers, wherein the one or more storage devices store instructions which, when executed by the one or more computers, cause the one or more computers to perform operations according to the corresponding method described in any of the preceding aspects.
[0041] According to a fourth aspect, there is provided one or more non-transitory computer storage media storing instructions which, when executed by one or more computers, cause the one or more computers to perform the operations of the corresponding method according to any of the preceding aspects.
[0042] The subject matter described in this specification can be implemented in specific embodiments to realize one or more of the following advantages.
[0043] The system described herein is capable of generating a sequence of data elements autoregressively, i.e., such that each data element in the sequence is generated conditionally based on the previous data elements in the sequence. In particular, to generate a data element at a position in a sequence, the system is capable of instantiating a set of potential embeddings and then using a neural network to process both: (i) a "current" sequence of data element embeddings representing the data element preceding the position, and (ii) the latent embeddings. The neural network is capable of updating the latent embeddings using cross-attention on the current sequence of data element embeddings, thereby enriching the latent embeddings with information from previously generated data element embeddings. Because the number of latent embeddings can be independent of the length of the current sequence of data element embeddings, the computational complexity of the cross-attention operation is partially decoupled from the length of the current sequence of data element embeddings. Thus, performing the cross-attention operation can remain computationally feasible even for lengthy sequences of data element embeddings, e.g., comprising hundreds of thousands of data element embeddings.
[0044] In addition to performing criss-cross attention operations, the neural network can also use self-attention operations to update the set of latent embeddings one or more times, which can enable the neural network to share information across the set of latent embeddings and perform complex implicit inferences. The number of latent embeddings can be significantly smaller than the length of the current sequence of data elements (e.g., one or more orders of magnitude smaller), and the computational complexity of the self-attention operation on the latent embeddings is independent of the length of the current sequence of data elements.
[0045] Thus, the criss-cross attention and self-attention operations operate in tandem to enable the neural network to consume significantly less computational resources (e.g., compared to conventional systems) while generating sequences of data elements that encode complex long-range patterns. Specifically, performing criss-cross attention (rather than, for example, self-attention) on sequences of data element embeddings enables the neural network to scale to efficiently generate very long sequences of data elements, e.g., millions of data elements, representing high-resolution images, video, or audio.
[0046] The details of one or more embodiments of the subject matter of this specification are set forth in the accompanying drawings and the description below. Other features, aspects, and advantages of the subject matter will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a block diagram of an example neural network system.
[0048] Figure 2 is a block diagram of a more detailed example neural network system.
[0049] Figure 3 is a flow chart of an example process for generating a sequence of data elements using a neural network.
[0050] Figure 4 is a flow chart of an example process for training a neural network to generate network outputs.
[0051] Figure 5 Example attention operations performed by the neural network systems described in this specification and other available systems are shown.
[0052] Figure 6 Example experimental results using a neural network system implementation are shown.
[0053] Figure 7 Another example of experimental results achieved using a neural network system is shown.
[0054] Fig. 8A and Figure 8B Another example of experimental results achieved using a neural network system is shown.
[0055] Like reference numbers and designations throughout the various drawings represent like elements. DETAILED DESCRIPTION
[0056] Figure 1 1 is a block diagram of an example neural network system 100 capable of generating a sequence of data elements 108 representing an entity. Neural network system 100 is an example of a system implemented as a computer program on one or more computers in one or more locations that implement the systems, components, and techniques described below.
[0057] The sequence of data elements 108 representing an entity can include a corresponding data element at each position in the sequence of data elements 108. In general, the sequence of data elements 108 can represent any suitable entity, such as any suitable type of data, and can include any suitable number of data elements, such as 1 data element, 10 data elements, 100 data elements, 1,000 data elements, 10,000 data elements, 1 million data elements, 5 million data elements, or any other suitable number of data elements.
[0058] In one example, each data element can represent a pixel in an image, such as an intensity value of a pixel, and the sequence of data elements 108 can collectively represent an image.
[0059] As another example, each data element can represent an audio sample in an audio waveform, e.g., a time or time-frequency sample, and the sequence of data elements 108 can collectively represent the audio waveform. As another example, each data element can represent a musical note, and the sequence of data elements can collectively represent a musical composition.
[0060] As another example, each data element can represent a pixel in a corresponding video frame of a video, eg, an intensity value of the pixel, and the sequence of data elements can collectively represent the video.
[0061] As another example, each data element can represent a corresponding structural parameter from a plurality of structural parameters that collectively define the structure of a protein. For example, for each position in a protein amino acid sequence, a corresponding data element can define a set of structural parameters that characterize the three-dimensional spatial configuration of the amino acid at that position. The set of structural parameters can include, for example, torsion angles of bonds between amino acids in a protein, such as backbone torsion angles, or three-dimensional (3D) coordinates defining the position of one or more atoms in an amino acid, such as nitrogen, alpha carbon, and beta carbon atoms of a protein.
[0062] As another example, each data element can represent an amino acid, and the sequence of data elements can collectively represent the amino acid sequence of a protein.
[0063] As another example, each data element can represent a character, a word fragment, or a word, and a sequence of data elements can collectively represent a piece of text.
[0064] As another example, each data element can represent the location of a point in 3D space, e.g., in an x, y, z coordinate system, and the sequence of data elements can collectively represent a point cloud. The point cloud can characterize the 3D geometry of an environment, e.g., where each point in the point cloud represents a point on a surface or object in the environment.
[0065] As another example, each data element can represent an action from a set of possible actions, e.g., the action can be performed by an agent interacting with an environment. A sequence of data elements can collectively represent a sequence of actions that can be performed by an agent to interact with an environment. The agent can be, e.g., a mechanical agent, such as a robot or an autonomous vehicle, and the environment can be a real-world environment.
[0066] Thus, the task performed by the neural network system can be to generate a sequence of data elements as described above either unconditionally (e.g., according to a training distribution) or conditionally (as further described below).
[0067] The neural network system 100 can process the potential embedding sequence 102 and the current sequence of data element embeddings 104 to generate a data element at a current position 107. Based on the data element at the current position 107, the system 100 can autoregressively generate a data element sequence 108, e.g., such that each data element in the data element sequence 108 is conditionally generated based on a previous data element in the data element sequence 108. For example, the neural network system 100 can conditionally generate a data element at a third position in the data element sequence 108 (e.g., the data element at the current position 107) based on previously generated data elements (e.g., based on a data element at a first position and a data element at a second position in the data element sequence 108). After generating the data element at the third position in the data element sequence 108, the neural network system 100 can conditionally generate a data element at a fourth position (e.g., the new current position) in the data element sequence 108 based on previously generated data elements (e.g., based on data elements at the first, second, and third positions in the data element sequence 108, etc.). Each time the neural network system 100 generates a data element at the current position 107, it can concatenate it to the sequence of data elements 108. In other words, the neural network system 100 can be configured to autoregressively generate a data element at each position in the sequence of data elements 108.
[0068] Specifically, to generate a data element at a current position 107 in a sequence of data elements 108, the neural network system 100 can process: (i) a current sequence of data element embeddings 104, and (ii) a sequence of potential embeddings 102. The current sequence of data element embeddings 104 can include a corresponding data element embedding at each position preceding the current position in the sequence of data elements 108. An "embedding" can generally refer to an ordered set of values, such as a vector, matrix, or other tensor of values. A "data element embedding" can refer to an embedding of a data element in the sequence of data elements 108. In some cases, each data element in the sequence of data elements can be associated with a predefined data element embedding. In other words, for each data element in the sequence of data elements, the system can generate a data element embedding by mapping the data element onto a corresponding data element embedding. In some cases, the potential embeddings in the sequence can be combined with a corresponding position encoding that defines the position of the potential embedding in the sequence, such as a learned position encoding, a relative position encoding, or a position encoding based on Fourier features. However, this is not required.
[0069] “Potential embedding” can refer to an embedding in a latent space. In some cases, the potential embedding sequence 102 can be defined based on the data element embedding sequence 104 (eg, based on a subsequence of the data element embedding sequence 104). This will be referred to below. Figure 2Described in more detail. In some cases, the potential embedding sequence 102 can be learned by the neural network system 100, that is, during training. Generally, the potential embedding sequence 102 can be obtained in any suitable manner. In some cases, each time the system 100 generates a data element at the current position 107, the system 100 can initialize a new sequence of potential embeddings 102. For example, each time the system 100 generates a data element at the current position 107, the system 100 can obtain the potential embedding sequence 102 by, for example, setting the potential embedding sequence 102 to a default (e.g., learned) value, or setting the potential embedding sequence 102 to be equal to the number of most recently processed data element embeddings in the current sequence 104 of data element embeddings. The number of most recently processed data element embeddings can be any suitable number of data element embeddings. In other words, each time the system 100 generates a data element at the current position 107, the system 100 can use a new potential embedding sequence 102.
[0070] In some cases, the number of potential embeddings in the potential embedding sequence 102 can be smaller than the number of data element embeddings in the current sequence of data element embeddings 104, e.g., at least an order of magnitude smaller. For example, if the current sequence of data element embeddings 104 represents a sequence of data elements having dimension The number of data elements embedded in the current sequence 104 of data elements embedded is , then the number of potential embeddings in the potential embedding sequence 102 can be, for example, , so that In some cases, the number of potential embeddings in the sequence of potential embeddings 102 can be predefined and independent of the number of data element embeddings in the current sequence of data element embeddings 104 .
[0071] To generate a data element at a current position 107 in a sequence of data elements 108, the neural network system 100 can use a neural network 160 comprising a sequence of neural network blocks to process: (i) a current sequence of data element embeddings 104, and (ii) a potential embedding sequence 102. A "neural network block" can generally refer to a group of one or more neural network layers in a neural network. The sequence of neural network blocks of the neural network 160 can include: (i) a criss-cross attention block 120, (ii) one or more self-attention blocks 130, and (iii) an output block 140. A self-attention block, or a criss-cross attention block, is generally a block that includes an attention mechanism, in particular a self-attention or criss-cross attention mechanism, respectively. There are many different types of attention mechanisms that can be used. In one example, as Figure 1As shown, the sequence of neural network blocks can include a first cross-attention block 120, followed by a first self-attention block 130, followed by a second self-attention block 130, followed by an output block 140. In general, the neural network 160 can include any suitable number of neural network blocks, for example, 5 blocks, 10 blocks, 15 blocks, 50 blocks, 100 blocks, or any other suitable number of neural network blocks. Furthermore, the neural network blocks can be arranged in the neural network 160 in any suitable sequence and / or configuration. In some cases, the cross-attention blocks 120 and the self-attention blocks 130 can be interleaved. The neural network system 100 can use the sequence of neural network blocks to process the current sequence 104 and the potential embedding sequence 102 of data element embeddings to generate a data element at a current position 107 in the sequence of data elements 108.
[0072] The attention blocks (e.g., cross-attention block 120 and self-attention block 130) can be configured to perform an attention operation, for example, by updating each embedding in the first embedding sequence using attention to the second embedding sequence. Typically, updating the first embedding sequence using attention to the second embedding sequence refers to updating the first embedding sequence by applying an attention mechanism on the second embedding sequence; there are many different possible attention mechanisms that can be used. For example, for each target embedding in the first embedding sequence, each attention block can generate a corresponding attention weight for each embedding in the second embedding sequence, and generate a combined embedding based on the second embedding sequence and the corresponding attention weights. As a specific example, each attention block can generate a combined embedding as a weighted sum of the second embedding sequence, for example, by multiplying each embedding in the second embedding sequence by a corresponding weight and summing the weighted embeddings. Each attention block can then use the combined embedding to update the target embedding in the first embedding sequence, for example, by replacing the target embedding with the combined embedding, adding the combined embedding to the target embedding, or in any other appropriate manner.
[0073] In some implementations, the attention block can perform a query-key-value Attention operations, for example, using the query ,key Sum embedding, updating each embedding in the first embedding sequence using attention to the second embedding sequence. In particular, each attention block can include: (i) a query subnetwork, (ii) a key subnetwork, and (iii) a value subnetwork. For each target embedding in the first embedding sequence, the query subnetwork can be configured to process the target embedding in the first embedding sequence to generate a corresponding query embedding of the target embedding The key subnetwork can be configured to process each embedding in the second embedding sequence to generate a corresponding key embedding for each embedding in the second embedding sequence. Similarly, the value subnetwork can be configured to process each embedding in the second embedding sequence to generate a corresponding value embedding for each embedding in the second embedding sequence .
[0074] Each attention block can then use the query embedding , key embedding Sum value embedding To update each target embedding in the first embedding sequence on the second embedding sequence. Specifically, each attention block can generate attention weights for each embedding in the second embedding sequence, for example, as the query embedding Embedded with each key Based on the second embedding sequence and the attention weights, each attention block is able to generate a combined embedding, e.g., as a value embedding weighted by their corresponding attention weights Finally, each attention block can use the combined embedding to update the target embedding in the first embedding sequence, for example, by using the value embedding The target embedding in the first embedding sequence is replaced by the weighted sum of
[0075] In some embodiments, the attention block can perform a masked attention operation by updating each embedding in the first embedding sequence using masked attention to the second embedding sequence. In general, "masking" a portion of a data set can refer to modifying the data set to remove some or all of the information content represented by the portion of the data set, for example, replacing the portion of the data set by a default (e.g., predefined or random) value, or by removing the portion of the data set. In some cases, each position in the first embedding sequence can correspond to a corresponding position in the second embedding sequence. A "masked" attention operation can refer to an attention operation that updates the embedding at each position in the first embedding sequence using attention only to the embedding at the same position in the second embedding sequence and / or one or more embeddings at previous positions in the second embedding sequence. That is, the attention may be causally masked so that it only covers earlier embeddings in the sequence. As described above, the attention operation can be performed by calculating attention weights. In some cases, the masked attention operation can include calculating an attention weight for each embedding in the second embedding sequence. Then, for each embedding in the first embedding sequence, the masked attention operation can include modifying the attention weight of the embedding in the second sequence at a position after the position corresponding to the embedding in the first embedding sequence being updated. The system can modify the attention weights, for example, by setting the weight values to zero, or in any other suitable manner.
[0076] As described above, the neural network system 100 can use cross-attention and self-attention operations to self-regressively generate a sequence of data elements 108, for example, to generate a data element at a current position 107, concatenate it to the current sequence 108 of data elements, and then use the current sequence 108 of data elements to generate a data element at the next position in the sequence 108. The masked attention operation can enable the system 100 to generate a data element at the current position 107 without depending on data elements at subsequent positions in the sequence 108 of data elements (e.g., during training). Thus, the masked attention operation enables the neural network to generate a data element at the current position 107 using operations that depend only on data elements at previous positions in the sequence 108.
[0077] In some embodiments, the first embedding sequence and the second embedding sequence can be different embedding sequences. In this case, the attention operation (e.g., Attention operations and masked attention operations) can be referred to as "cross-attention" operations. The cross-attention operation can be performed by, for example, cross-attention block 120. For example, the first embedding sequence can be the potential embedding sequence 102, the second embedding sequence can be the current sequence 104 of data element embeddings, and the cross-attention block 120 can update each potential embedding using the cross-attention to the current sequence 104 of data element embeddings.
[0078] In some cases, each position in the sequence of potential embeddings 102 can correspond to a corresponding position in the sequence of data element embeddings 104. The cross-attention block 120 can perform a masked attention operation, e.g., as described above. That is, the cross-attention block 120 can update each potential embedding in the sequence of potential embeddings 102 using masked attention to the current sequence of data element embeddings 104. As a specific example, for each potential embedding, the cross-attention block 120 can update the potential embedding using only attention to: (i) the data element embedding at the position corresponding to the potential embedding, and (ii) any data element embedding at positions preceding the position corresponding to the potential embedding.
[0079] In some embodiments, the first embedding sequence and the second embedding sequence can be the same embedding sequence. In this case, the attention operation (e.g., Attention operations and masked attention operations) can be referred to as "self-attention" operations. The self-attention operation can be performed by, for example, self-attention block 130. For example, the first embedding sequence can be potential embedding sequence 102, the second embedding sequence can also be a potential embedding sequence, and self-attention block 130 can update each potential embedding in potential embedding sequence 102 using self-attention to the potential embedding sequence. In some embodiments, self-attention block 130 can repeatedly update each potential embedding in the potential embedding sequence using self-attention to the potential embedding sequence.
[0080] In some cases, self-attention block 120 can perform a masked attention operation, e.g., as described above. That is, self-attention block 130 can update each potential embedding in sequence of potential embeddings 102 using masked attention to the sequence of potential embeddings. As a specific example, for each potential embedding, self-attention block 130 can update the potential embedding using attention only to: (i) the potential embedding, and (ii) any potential embeddings preceding the potential embedding in the sequence of potential embeddings.
[0081] The above examples of masked attention are provided for illustrative purposes only. Figure 2 In some cases, the neural network system 100 can use the attention block to perform other types of attention operations, such as attention operations other than the masked attention operation, such as the above attention operations, or any other type of attention operations.
[0082] In some embodiments, in addition to the above-mentioned attention operations, the cross-attention block 120 and the self-attention block 130 can be configured to perform other operations. For example, in addition to implementing one or more attention neural network layers, the attention block can also include any suitable number (e.g., 2 layers, 5 layers, or 10 layers) and any other neural network layers (e.g., convolutional layers, fully connected layers, recurrent layers, attention layers, etc.) connected in any suitable configuration (e.g., as a linear sequence of layers).
[0083] In addition to the attention block, the neural network 160 can also include an output block 140. During inference, the output block 140 can be configured to generate a data element embedding at a current position 107 in the sequence of data elements 108. In some cases, during training of the neural network 160, the output block 140 can be configured to generate an output (e.g., a score distribution, as described in more detail below) for each output position in the sequence of output positions.
[0084] Specifically, during inference, the output block 140 can process the output from the last attention block in the sequence of attention blocks, e.g., one or more potential embeddings from the sequence of potential embeddings, to generate a data element at the current position 107 in the sequence of data elements 108. For example, the output block 140 can process the one or more potential embeddings from the sequence of potential embeddings using one or more neural network layers included in the output block 140 to generate a score distribution over a set of possible data elements. The score distribution can define, for example, a corresponding score for each data element in the set of possible data elements. The output block 140 can then use the score distribution to select a data element at the current position 107, e.g., by sampling data elements from the set of possible data elements according to the score distribution. The set of possible data elements can be any suitable set of data elements, e.g., a set of possible audio samples, a set of possible phonemes or graphemes, a set of possible characters or word fragments or words, a set of possible protein structure parameters, or any other suitable set of data elements.
[0085] During training, the output block 140 can be configured to generate, for each output position in the sequence of output positions, a network output for the output position by processing a corresponding latent embedding from the sequence of latent embeddings. In other words, the output block 140 can process the latent embedding at a position in the sequence of latent embeddings to generate a network output (e.g., a score distribution over a set of possible data elements) at the corresponding position in the sequence of output positions. The system 100 can then train the neural network 160 using the score distribution generated for each output position in the sequence of output positions. This will be described in more detail below. As described above, the neural network system 100 can self-regressively generate the sequence of data elements 108 using cross-attention and self-attention operations. The cross-attention and self-attention operations can operate in synergy to enable the neural network system 100 to significantly reduce the consumption of computational resources (e.g., compared to conventional systems) while generating the sequence of data elements 108 that encodes complex long-range patterns. Specifically, performing cross-attention (rather than, for example, self-attention) on the sequence of data element embeddings 104 can enable the neural network system 100 to scale to efficiently generate very long sequences of data elements 108, for example, millions of data elements that represent high-resolution images, videos, or audio.
[0086] In general, neural network 160 can have any suitable neural network architecture that enables it to perform its specified functions. For example, neural network 160, and each of cross-attention block 120, self-attention block 130, and output block 140 can have any suitable number (e.g., 2 layers, 5 layers, or 10 layers) and any suitable neural network layers (e.g., convolutional layers, fully connected layers, recurrent layers, attention layers, etc.) connected in any suitable configuration (e.g., as a linear sequence of layers). Neural network system 100 can also additionally include any number of neural network blocks configured to perform any suitable operations.
[0087] In general, the attention blocks can be arranged in any suitable configuration. For example, the system 100 can include an attention block sequence having two cross-attention blocks 120, followed by two self-attention blocks 130, followed by two cross-attention blocks 120. In another example, the system 100 can include an attention block sequence having one cross-attention block 120, followed by multiple self-attention blocks 130. In general, the system 100 can include any number of attention blocks 120, 130 (e.g., 5, 10, 100, etc.) arranged in any suitable configuration.
[0088] As described above, the neural network 160 can generate the sequence of data elements 108 autoregressively, i.e., such that each data element in the sequence 108 is generated conditionally based on the previous data elements in the sequence 108. In some embodiments, the neural network 160 can be conditioned on data that specifies one or more desired characteristics of the sequence of data elements 108 to be generated by the neural network 160. If the neural network is not conditioned in this manner, it can be used to obtain examples of sequences of data elements from a training distribution - i.e., from the distribution of the set of training examples used to train the neural network, e.g., another image or sound that is similar to an image or sound that the system has been trained on, or a protein or DNA sequence that has similar characteristics to other sequences that the system has been trained on. Thus, the neural network need not be conditioned on data that specifies desired sequence characteristics.
[0089] In general, "conditioning" a neural network can refer to providing conditioning data as input to the neural network such that the neural network processes the conditioning data jointly with any other neural network inputs, e.g., the potential embedding sequence and the current sequence of data element embeddings. In general, the conditioning data can be processed by the neural network in any suitable manner, e.g., it can be processed as additional input by one or more attention blocks in a sequence of neural network blocks. Several examples of conditioning data are described next.
[0090] In one example, the conditioning data can characterize a text sequence, and when conditioned on the conditioning data, the neural network can generate a sequence of data elements representing a verbal utterance of the text sequence, e.g., where each data element represents an audio sample in an audio waveform. Thus, the system can perform a text-to-speech conversion task. Additionally or alternatively, the conditioning data can identify an expected speaker of the audio, i.e., cause the system to generate audio data representing the speech of the expected speaker. As another example, the conditioning data can specify a classification of the audio waveform as one of a set of possible categories, such that the system generates audio data belonging to that category, e.g., a musical genre or an instrument.
[0091] As another example, the regulatory data can define a set of properties of a protein (e.g., stability, solubility, etc.), and when conditioned on the regulatory data, the neural network can generate data defining proteins predicted to have the properties specified by the regulatory data. As some other examples, the regulatory data can specify genes to be activated by a DNA sequence, or regulatory properties of a DNA sequence or protein, or target binding sites of a DNA sequence or protein. The data defining the protein can be, for example, a protein structure or amino acid sequence as described above. Such a system can be trained from real-world experimental data. The DNA sequence, for example, the protein can then be physically synthesized.
[0092] As another example, the conditioning data can specify one or more features of an image (e.g., an object shown in the image and optionally its location), and when conditioned on the conditioning data, the neural network can generate an image having the features specified by the conditioning data. Thus, the conditioning data can specify a classification of an image or a portion of an image as one of a set of possible categories, so that the system generates an image or portion of an image belonging to that category. As another example, the conditioning data can specify the location of an object to be included in the generated image (which need not involve specifying the object). As another example, the conditioning data can be a text sequence and the output data item can be an image describing the text, i.e., the conditioning input can be a subtitle for the output image.
[0093] As another example, the conditioning data can specify one or more features of the point cloud (e.g., an object represented by the point cloud), and when conditioned on the conditioning data, the neural network can generate a point cloud having the features specified by the conditioning data. Examples of conditioning data for point cloud generation are those conditioning data described above for image generation.
[0094] As another example, the conditioning data can specify one or more characteristics of a text sequence (eg, a topic of the text sequence), and when conditioned on the conditioning data, the neural network can generate a text sequence having the characteristics specified by the conditioning data.
[0095] Neural network system 100 can also include a training engine that can train neural network 160 on a training data set through multiple training iterations. The training data can include a set of training examples, where each training example specifies: (i) a training input, and (ii) a target output that should be generated by neural network 160 by processing the training input.
[0096] In each training iteration, the training engine can sample a batch of training examples from the training data and process the training inputs specified by the training examples using a sequence of neural network blocks included in neural network 160 to generate corresponding network outputs. In particular, for each training input, neural network 160 uses the first attention block in the sequence (e.g., Figure 1 The neural network 160 processes the training input using the current model parameter values of the cross-attention block 120 in the sequence to generate the output from the first attention block. The neural network 160 uses the second attention block in the sequence (e.g., Figure 1 The neural network 160 uses the current model parameter values of the output block 140 to process the output generated by the last attention block in the sequence (e.g., Figure 1 The output generated by the self-attention block 130 in θ is used to generate the network output corresponding to the training input.
[0097] The training engine can adjust the model parameter values of the attention blocks 120, 130 and the output block 140 to optimize an objective function that measures the similarity between: (i) the network output generated by the neural network 160, and (ii) the target network output specified by the training examples. The objective function can be, for example, a cross entropy objective function, a squared error objective function, or any other suitable objective function.
[0098] The training engine can determine the gradient of the objective function, for example, using a back-propagation technique. The training engine can use the gradient (e.g., using any suitable gradient descent optimization algorithm, such as Adam) to update the model parameter values of the attention blocks 120, 130 and the output block 140. The training engine can determine the performance measure of the neural network 160 on a validation data set that is not used during the training of the neural network 160. After training, the neural network system 100 can be used to perform machine learning tasks, such as generating a sequence of data elements 108. Figure 4 An example process for training neural network 160 is described in more detail.
[0099] Reference below Figure 2 Neural network system 100 is described in more detail.
[0100] Figure 2 is a more detailed example neural network system 200 (e.g., Figure 1 Neural network system 200 is an example of a system implemented as a computer program on one or more computers in one or more locations that implement the systems, components, and techniques described below.
[0101] Neural network system 200 can include a sequence of neural network blocks, such as one or more attention blocks and an output block. Figure 2 A specific example is shown in FIG. 2 , where the neural network system 200 includes a cross-attention block 220, followed by a self-attention block 230, followed by an output block 240. As described above with reference to Figure 1 As described, the neural network system 200 can obtain a current sequence 204 of data element embeddings and a potential embedding sequence 202. The system 200 can process the current sequence 204 of data element embeddings and the potential embedding sequence 202 using a sequence of neural network blocks to generate a data element sequence 208.
[0102] like Figure 2 As shown, the current sequence 204 of data element embeddings represents a word ("PerceiverAR"), where each data element embedding represents a letter at a corresponding position of the word. The system 200 can obtain the current sequence 204 of data element embeddings including a corresponding data element embedding of each data element at a position preceding a current position, for example, the current position can be the position following the position of the letter "R" in the sequence.
[0103] like Figure 2 As shown, the potential embedding sequence 202 can be defined based on the current sequence 204 of data element embeddings. Specifically, the system 200 can obtain the potential embedding sequence 202 by identifying a subsequence of the current sequence 204 of data element embeddings. In some cases, the system 200 can identify a predefined number of last data element embeddings in the data element embedding sequence 204. For example, Figure 2 As shown, the system 200 can identify the subsequence as the data element embeddings (e.g., "r," "A," and "R") at the last three positions in the data element embedding sequence 204. In general, the system 200 can identify the subsequence of the current sequence 204 of data element embeddings in any suitable manner, for example, the subsequence can include any suitable number of data element embeddings. After identifying the subsequence of the current sequence 204 of data element embeddings, the system 200 can set the potential embedding sequence 202 to the subsequence, for example, so that the potential embedding sequence 202 includes data element embeddings representing the letters "r," "A," and "R."
[0104] The crisscross attention block 220 can update each potential embedding in the potential embedding sequence 202 using masked attention 221 to the current sequence 204 of data element embeddings. Specifically, the crisscross attention block 220 can update each potential embedding using attention only to: (i) the data element embedding at the position corresponding to the potential embedding, and (ii) any data element embedding at the position before the position corresponding to the potential embedding. For example, Figure 2 As shown, the cross-attention block 220 can update the potential embeddings in the potential embedding sequence 202 representing the letter "r" using attention only to the data element embedding at the position corresponding to the potential embedding representing the letter "r" and any data element embeddings at positions before the position corresponding to the potential embedding representing the letter "r". These data element embeddings are shown as Figure 2 The filled black squares spelling out the word “Perceiver” in the attention mask 221 in FIG. 20 . In contrast, the data elements that are not used to update the latent embeddings in the latent embedding sequence 202 are embedded by Figure 2 The empty squares in the attention mask 221 in are shown.
[0105] Similarly, criss-cross attention block 220 can update the potential embeddings in sequence of potential embeddings 202 representing the letter “A” using attention only to the data element embedding at the position corresponding to the potential embedding representing the letter “A” and any data element embeddings at positions preceding the position corresponding to the potential embedding representing the letter “A”. These data element embeddings are shown as Figure 2 The filled squares spelling the word “PerceiverA” in the attention mask 221 in FIG.
[0106] Self-attention block 230 can update each potential embedding in the potential embedding sequence 202 using masked attention 231 to the potential embedding sequence 202. Specifically, self-attention block 230 can update each potential embedding using attention only to: (i) the potential embedding, and (ii) any potential embeddings preceding the potential embedding in the potential embedding sequence 202. For example, Figure 2 As shown, the self-attention block 230 is able to update the latent embeddings in the latent embedding sequence 202 (in Figure 2 Similarly, self-attention block 230 can update the latent embeddings in sequence 202 of latent embeddings representing the letter “A” using attention to the latent embedding representing the letter “A” and the latent embedding representing the letter “r” (e.g., the previous latent embedding). The latent embeddings not used to update the latent embeddings in sequence 202 are represented by Figure 2 The empty squares in the attention mask 231 in are shown.
[0107] After updating the latent embedding sequence 202 using the cross-attention block 220 and the self-attention block 230, the system can provide the output from the last attention block (e.g., the self-attention block 230) to the output block 240. The output block 240 can process one or more latent embeddings from the latent embedding sequence 202 to generate a data element at the current position in the data element sequence 208. Figure 2 As shown, at the current position, e.g., the position following the letter “R” in sequence 208, output block 240 generates an end-of-sequence symbol “EOS”. In some cases, for each output position in the sequence of output positions, output block 240 can generate a network output for the output position by processing the corresponding latent embedding from the sequence of latent embeddings. For example, Figure 2 As shown, output block 240 can process a first potential embedding in potential embedding sequence 202 to generate a score distribution over a set of possible data elements for a first output position. Similarly, output block 240 can process a second potential embedding in potential embedding sequence 202 to generate a score distribution over a set of possible data elements for a second output position. Furthermore, output block 240 can process a last potential embedding in potential embedding sequence 202 to generate a score distribution over a set of possible data elements for a last output position.
[0108] An example process for generating data element sequence 208 using neural network system 200 is described next in more detail.
[0109] Figure 3 is a flow chart of an example process 300 for iteratively generating a sequence of data elements using a neural network. For convenience, process 300 is described as being performed by a system of one or more computers located in one or more locations. For example, a neural network system (e.g., Figure 1 Neural network system 100 or Figure 2 The neural network system 200 is capable of performing process 300.
[0110] The system generates a data element sequence including a corresponding data element at each position in the position sequence (302). The data element sequence can define, for example, an image, an audio waveform, a sequence of musical notes, the structure of a protein, or a video. In some cases, the system can generate the data element sequence autoregressively, for example, as described above with reference to Figure 1 described.
[0111] For each position after the first position in the sequence of positions, the system obtains a current sequence of data element embeddings (304) including a corresponding data element embedding for each data element at the position before the current position, and a sequence of potential embeddings (306). In some cases, the number of potential embeddings in the sequence of potential embeddings can be less than the number of data element embeddings in the current sequence of data element embeddings, e.g., at least an order of magnitude less than the number of data element embeddings. In some cases, for each position after the first position in the sequence of positions, the number of potential embeddings in the sequence of potential embeddings can be predefined and independent of the number of data element embeddings in the current sequence of data element embeddings.
[0112] For one or more positions in the sequence of positions, the system can obtain a potential embedding sequence by, for example, identifying a subsequence of a current sequence of data element embeddings. The subsequence can include, for example, a predefined number of last data element embeddings in the sequence of data element embeddings. The system can determine a potential embedding sequence based on a subsequence of a current sequence of data element embeddings by, for example, setting the potential embedding sequence equal to the subsequence of the current sequence of data element embeddings.
[0113] The system uses a neural network to process: (i) the current sequence of data element embeddings, and (ii) the potential embedding sequence to generate a data element at the current position (308). As described above with reference to Figure 1 and Figure 2 The neural network can include a sequence of neural network blocks, including: (i) a cross-attention block, (ii) one or more self-attention blocks, and (iii) an output block.
[0114] The criss-cross attention block can perform operations including updating each potential embedding in the sequence of potential embeddings using attention to the current sequence of data element embeddings. In some embodiments, the criss-cross attention block can update each potential embedding in the sequence of potential embeddings using masked attention to the current sequence of data element embeddings. In some cases, each potential embedding can correspond to a corresponding position in the sequence of positions. In this case, the criss-cross attention block can update each potential embedding using attention only to: (i) the data element embedding at the position corresponding to the potential embedding, and (ii) any data element embedding at a position prior to the position corresponding to the potential embedding.
[0115] Each self-attention block can perform an operation including updating each potential embedding in the sequence of potential embeddings using attention to the sequence of potential embeddings. In some embodiments, the self-attention block can update each potential embedding in the sequence of potential embeddings using masked attention to the sequence of potential embeddings. For example, for each potential embedding, the self-attention block can update the potential embedding using attention only to: (i) the potential embedding, and (ii) any potential embeddings that precede the potential embedding in the sequence of potential embeddings.
[0116] The output block can perform an operation including: processing one or more potential embeddings from the potential embedding sequence to generate a data element at a current position after updating the potential embedding sequence using a cross-attention block and one or more self-attention blocks. For example, the output block can process one or more potential embeddings from the potential embedding sequence to generate a score distribution over a set of possible data elements. The output block can then use the score distribution over the set of possible data elements to select a data element at the current position, for example, sampling data elements at the current position from the set of possible data elements according to the score distribution. In some cases, the output block can select the data element embedding with the highest score.
[0117] After generating the data element embedding at the current position, the system can concatenate the data element embedding at the current position to the current sequence of data elements (310). The system can determine whether a termination criterion is met. The termination criterion can be any suitable termination criterion, for example, the system can generate a sequence end token (e.g., Figure 2 ). If the system determines that the termination criteria are met, the system can output the final sequence of data elements (312). However, if the system determines that the termination criteria are not met, the system can return to obtaining the current sequence of data element embeddings (304). In this case, the system can generate the current sequence of data element embeddings based on a sequence of data elements including the data element embedding at the current position generated at a previous iteration.
[0118] Next reference Figure 4 An example process for training a neural network to generate a network output is described in more detail.
[0119] Figure 4 is a flow chart of an example process 400 for training a neural network to generate a network output. For convenience, process 400 is described as being performed by a system of one or more computers located in one or more locations. For example, a neural network system (e.g., Figure 1 Neural network system 100 or Figure 2 The neural network system 200 is capable of performing process 400.
[0120] As mentioned above Figure 1 The system can include a training engine capable of training a neural network on a set of training data over multiple training iterations. The training data can include a set of training examples, where each training example specifies: (i) a training input, and (ii) a target output that should be generated by the neural network by processing the training input. The training input can include, for example, a representation of a sequence of data elements as a sequence of data element embeddings including a corresponding data element at each input position in a sequence of input positions. The target output can include, for example, a target data element for each output position in a sequence of output positions. The process steps (402)-(410) described below provide an example process for training a neural network on a single training example from a set of training examples.
[0121] At each training iteration, the system can obtain a representation of the sequence of data elements as a sequence of data element embeddings (402) and a sequence of latent embeddings (404). In some cases, for each latent embedding, the system can determine the latent embedding based on the data element embedding at the input position corresponding to the latent embedding, e.g., by setting the latent embedding equal to the data element embedding at the input position corresponding to the latent embedding. Figure 2 , the system can, for example, set the potential embedding at the eleventh (eg, last) input position to be equal to the data element embedding representing the letter "R" at the eleventh (eg, last) input position.
[0122] At each training iteration, the system can use the neural network to process: (i) the data element embedding sequence, and (ii) the latent embedding sequence to generate a corresponding network output (406) for each output position in the output position sequence. Figure 1 The neural network can include a sequence of neural network blocks, the neural network blocks including: (i) a cross-attention block, (ii) one or more self-attention blocks, and (iii) an output block.
[0123] The criss-cross attention block can update each latent embedding in the latent embedding sequence using masked attention on the data element embedding sequence. Figure 1 and Figure 2 As described above, each cross-attention block can update the latent embedding using attention only to: (i) the data element embedding at the input position corresponding to the latent embedding, and (ii) any data element embedding at the input position before the input position corresponding to the latent embedding. Similarly, each self-attention block can update each latent embedding in the latent embedding sequence using masked attention to the latent embedding sequence. For example, as described above with reference to Figure 1 and Figure 2As described above, each self-attention block is able to update the latent embedding using attention only on: (i) the latent embedding, and (ii) any latent embedding that precedes the latent embedding in the sequence of latent embeddings.
[0124] After updating the sequence of potential embeddings using the criss-cross attention block and the one or more self-attention blocks, for each output position in the sequence of output positions, the output block can generate a network output for the output position by processing the corresponding potential embedding from the sequence of potential embeddings. For each output position in the sequence of output positions, the network output for the output position can include a score distribution over a set of possible data elements. The output block can select the network output for the output position, for example, using the score distribution over the set of possible data elements.
[0125] At each training iteration, the system can determine, for example using a back-propagation technique, a gradient of an objective function with respect to a set of neural network parameters of the neural network (408). The objective function can measure, for each output position in the sequence of output positions, the error (e.g., a cross-entropy error) between: (i) a distribution of scores over a set of possible data elements at the output position, and (ii) a target data element for the output position (e.g., specified by a training example).
[0126] At each training iteration, the system can use the gradients to update current values of a set of neural network parameters of the neural network (410), e.g., using any suitable gradient descent optimization algorithm, such as Adam. The system can determine a performance measure of the neural network on a validation data set that was not used during training of the neural network. After training, the system can be used to perform machine learning tasks, e.g., to generate a sequence of data elements.
[0127] In some cases, the target data element for each output position can be the data element at the next input position in the sequence of data elements following the input position corresponding to the latent embedding processed to generate the score distribution at the output position. Figure 2 In the example in , the target data element at the first position in the output position sequence is "A", and the target data element at the second position in the output position sequence is "R", and the target element at the third position in the output position sequence is " <eos>”.
[0128] Reference below Figure 5 Describe in more detail example attention operations performed by the neural network systems described in this specification and other available systems.
[0129] Figure 5 The neural network system described in this specification (e.g., Figure 1 Neural network system 100 or Figure 2 The neural network system 200 of FIG. 200 and other example attention operations performed by the system can be used. Specifically, Figure 5 500 ( 500 ) shows the context range of the neural network system described in this specification and other available systems. In general, "context range" refers to how many previous data element embeddings the system can pay attention to in order to enrich the potential embedding with information when performing the attention operation. It can be understood that the context range 500 ( Figure 5 "Perceiver AR") than alternative systems ( Figure 5 The context range 500 of the "Transformer XL" and "Transformer" in this specification is significantly wider. In particular, the neural network system described in this specification is able to utilize information from a larger number of data element embeddings to enrich the latent embeddings without requiring a larger number of latent embeddings (e.g., a wider self-attention stack). Thus, the neural network system described in this specification provides cross-attention and self-attention operations that operate in tandem to enable the neural network system to significantly reduce consumption of computational resources (e.g., compared to conventional systems) while generating sequences of data elements that encode complex long-range patterns.
[0130] Figure 6 shows the use of neural network systems (e.g., Figure 1 Neural network system 100 or Figure 2 Example experimental results 600 of the neural network system 200). Specifically, Figure 6 Four image panels are shown, where each panel includes an image generated by a neural network system using a specific number of potential embeddings in a sequence of potential embeddings. The first panel shows an image generated using only 16 potential embeddings. The second panel shows an image generated using 1024 potential embeddings. The third panel shows an image generated using 1536 potential embeddings. The last panel shows an image generated using 2048 potential embeddings.
[0131] It will be appreciated that the neural network systems described herein are able to intelligently share information across latent embeddings in a sequence of latent embeddings, and in some cases perform complex implicit inferences, regardless of the length of the sequence. Figure 6 As shown, the system is able to efficiently generate images using latent embedding sequences containing as few as 16 latent embeddings and as many as 2048 latent embeddings.
[0132] Figure 7 shows the use of neural network systems (e.g., Figure 1 Neural network system 100 or Figure 2 Another example of experimental results achieved by the neural network system 200). Specifically, Figure 7 The language modeling results in the complexity (ppl.) of the neural network system described in this specification (e.g., "PerceiverAR") and the alternative neural network system are shown, where lower is better. It can be appreciated that the neural network system described in this specification is able to provide longer context lengths and significantly outperforms the alternative system on the language modeling task.
[0133] Fig. 8A and Figure 8B shows the use of neural network systems (e.g., Figure 1 Neural network system 100 or Figure 2 Another example of experimental results 800 achieved by the neural network system 200) is shown. Specifically, Fig. 8A Music generation results in negative log-likelihood for the neural network systems described in this specification (e.g., "Perceiver AR") and alternative neural network systems are shown, where lower is better. Figure 8B Results for audio generation with a fixed context length of 65536 in the negative log-likelihood for a neural network system described in this specification (e.g., "Perceiver AR") and an alternative neural network system are shown, where lower is better. Fig. 8A and Figure 8B As shown, the neural network system described in this specification is able to significantly outperform alternative systems on music / audio generation tasks.
[0134] This specification uses the term "configuration" in conjunction with system and computer program components. For a system of one or more computers to be configured to perform a particular operation or action, it means that the system has installed thereon software, firmware, hardware, or a combination thereof that, in operation, causes the system to perform the operation or action. For one or more computer programs to be configured to perform a particular operation or action, it means that the one or more programs include instructions that, when executed by a data processing device, cause the device to perform the operation or action.
[0135] The embodiments of the subject matter and functional operations described in this specification can be implemented in digital electronic circuits, tangibly embodied computer software or firmware, computer hardware (including the structures disclosed in this specification and their structural equivalents), or a combination of one or more of them. The embodiments of the subject matter described in this specification can be implemented as one or more computer programs, that is, one or more modules of computer program instructions encoded on a tangible non-transitory storage medium for execution by a data processing device or for controlling the operation of a data processing device. The computer storage medium can be a machine-readable storage device, a machine-readable storage medium, a random or serial access memory device, or a combination of one or more of them. Alternatively or additionally, the program instructions can be encoded on an artificially generated propagation signal, such as a machine-generated electrical, optical or electromagnetic signal, which is generated to encode information for transmission to a suitable receiver device for execution by a data processing device.
[0136] The term "data processing apparatus" refers to data processing hardware and covers all kinds of apparatus, devices and machines for processing data, including, for example, a programmable processor, a computer or multiple processors or computers. The apparatus can also be or further include special-purpose logic circuits, such as an FPGA (field programmable gate array) or an ASIC (application-specific integrated circuit). In addition to hardware, the apparatus can optionally include code that creates an execution environment for a computer program, for example, code constituting processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of them.
[0137] A computer program (which may also be referred to or described as a program, software, software application, app, module, software module, script, or code) can be written in any form of programming language (including compiled or interpreted languages or declarative or procedural languages); and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A program may, but need not, correspond to a file in a file system. A program can be stored in a portion of a file that holds other programs or data, such as one or more scripts stored in a markup language document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions). A computer program can be deployed to be executed on one computer or on multiple computers located at one site or distributed over multiple sites and interconnected by a data communications network.
[0138] In this specification, the term "engine" is used broadly to refer to a software-based system, subsystem, or process that is programmed to perform one or more specific functions. Typically, an engine will be implemented as one or more software modules or components installed on one or more computers in one or more locations. In some cases, one or more computers will be dedicated to a specific engine; in other cases, multiple engines can be installed and run on the same computer or multiple computers.
[0139] The processes and logic flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform functions by operating on input data and generating output. The processes and logic flows can also be performed by a special purpose logic circuit (e.g., FPGA or ASIC) or by a combination of a special purpose logic circuit and one or more programmed computers.
[0140] A computer suitable for executing a computer program can be based on a general or special purpose microprocessor or both, or any other kind of central processing unit. Typically, the central processing unit will receive instructions and data from a read-only memory or a random access memory or both. The basic elements of a computer are a central processing unit for executing or executing instructions and one or more memory devices for storing instructions and data. The central processing unit and the memory can be supplemented by or incorporated into a special logic circuit. Typically, the computer will also include or be operably coupled to receive data from or transmit data to or to one or more mass storage devices (e.g., magnetic, magneto-optical disks or optical disks) for storing data. However, the computer does not need to have such a device. In addition, the computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device, such as a universal serial bus (USB) flash drive, to name a few.
[0141] Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, including, for example, semiconductor memory devices, such as EPROM, EEPROM, and flash memory devices; magnetic disks, such as internal hard disks or removable disks; magneto-optical disks; and CD-ROM and DVD-ROM disks.
[0142] To provide interaction with a user, embodiments of the subject matter described in this specification can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user, and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback, such as visual feedback, auditory feedback, or tactile feedback; and input from the user can be received in any form, including acoustic, voice, or tactile input. In addition, the computer can interact with the user by sending documents to and receiving documents from a device used by the user; for example, by sending a web page to a web browser on a user's device in response to a request received from the web browser. In addition, the computer can interact with the user by sending a text message or other form of message to a personal device (e.g., a smart phone running a messaging application) and receiving a response message from the user in response.
[0143] The data processing apparatus for implementing the machine learning model can also include, for example, dedicated hardware accelerator units for processing the common and computationally intensive parts (i.e., inference, workloads) of machine learning training or production.
[0144] Ability to implement and deploy machine learning models using machine learning frameworks such as the TensorFlow framework.
[0145] Embodiments of the subject matter described in this specification can be implemented in a computing system that includes a back-end component (e.g., as a data server), or includes a middleware component (e.g., an application server), or includes a front-end component (e.g., a client computer with a graphical user interface, a web browser, or an application through which a user can interact with an implementation of the subject matter described in this specification), or any combination of one or more such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks (LANs) and wide area networks (WANs), such as the Internet.
[0146] A computing system can include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of the client and server occurs by means of computer programs that run on respective computers and have a client-server relationship with each other. In some embodiments, the server transmits data (e.g., an HTML page) to a user device, for example, to display data to a user interacting with the device and to receive user input from the user, who acts as a client. Data generated at the user device (e.g., the result of the user interaction) can be received from the device at the server.
[0147] Although this specification contains many specific implementation details, these should not be interpreted as limitations on the scope of any invention or the scope that can be claimed, but rather as descriptions of features that can be specific to a particular embodiment of a particular invention. Certain features described in the context of a separate embodiment in this specification may also be implemented in combination in a single embodiment. On the contrary, the various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments. In addition, although features may be described above as working in certain combinations and even initially claimed as such, in some cases, one or more features from the claimed combination may be deleted from the combination, and the claimed combination may involve a variant of a sub-combination or a sub-combination.
[0148] Similarly, although operations are depicted in the drawings and recited in the claims in a particular order, this should not be construed as requiring that such operations be performed in the particular order shown or in sequence, or that all of the illustrated operations be performed to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system modules and components in the above-described embodiments should not be construed as requiring such separation in all embodiments, and it should be understood that the described program components and systems may generally be integrated together in a single software product or packaged into multiple software products.
[0149] Specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. For example, the actions recited in the claims can be performed in a different order and still achieve the desired results. As an example, the processes depicted in the accompanying drawings do not necessarily require the particular order or sequential order shown to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous.< / eos>
Claims
1. A method performed by one or more computers, the method comprising: generating a sequence of data elements, the sequence of data elements comprising a corresponding data element at each position in a sequence of positions, and for each position after a first position in the sequence of positions, comprising: obtaining a current sequence of data element embeddings, the current sequence of data element embeddings comprising a corresponding data element embedding for each data element at a position preceding the current position; Obtaining a latent embedding sequence; processing, using a neural network, (i) the current sequence of embeddings of the data element, and (ii) the sequence of latent embeddings to generate the data element at the current position, wherein the neural network comprises a sequence of neural network blocks, the sequence of neural network blocks comprising: (i) a cross-attention block, (ii) one or more self-attention blocks, and (iii) an output block, The cross attention block performs an operation, wherein the operation includes: updating each latent embedding in the sequence of latent embeddings using attention on the current sequence of data element embeddings; Each self-attention block performs an operation, including: updating each latent embedding in the sequence of latent embeddings using attention on the sequence of latent embeddings; The output block performs an operation, wherein the operation includes: After the latent embedding sequence is updated using the cross-attention block and the one or more self-attention blocks, one or more latent embeddings from the latent embedding sequence are processed to generate the data element at the current position.
2. The method according to claim 1, wherein Updating each latent embedding in the sequence of latent embeddings using attention on the current sequence of data element embeddings comprises: Each latent embedding in the sequence of latent embeddings is updated using masked attention on the current sequence of data element embeddings.
3. The method according to claim 2, wherein: Each latent embedding corresponds to a corresponding position in the sequence of positions, and wherein, for each latent embedding, updating each latent embedding in the sequence of latent embeddings using masked attention on the current sequence of data element embeddings comprises: The latent embedding is updated using attention only on: (i) the data element embedding at the position corresponding to the latent embedding, and (ii) any data element embeddings at positions before the position corresponding to the latent embedding.
4. A method according to any preceding claim, wherein: Updating each latent embedding in the sequence of latent embeddings using attention on the sequence of latent embeddings comprises: Each latent embedding in the sequence of latent embeddings is updated using masked attention on the sequence of latent embeddings.
5. The method according to claim 4, wherein For each latent embedding in the sequence of latent embeddings, updating each latent embedding in the sequence of latent embeddings using masked attention on the sequence of latent embeddings comprises: The latent embedding is updated using attention on only: (i) the latent embedding, and (ii) any latent embeddings preceding it in the sequence of latent embeddings.
6. A method according to any preceding claim, wherein: For one or more positions in the position sequence, obtaining the potential embedding sequence comprises: identifying a subsequence of the current sequence in which the data element is embedded; and The potential embedding sequence is determined based on the subsequence of the current sequence of embedding of the data elements.
7. The method according to claim 6, wherein: The subsequence of the current sequence of data element embeddings comprises a last predefined number of data element embeddings in the sequence of data element embeddings.
8. The method according to any one of claims 6 to 7, wherein Determining the potential embedding sequence based on the subsequence of the current sequence of embedding of the data elements comprises: The potential embedding sequence is set equal to the subsequence of the current sequence in which the data elements are embedded.
9. A method according to any preceding claim, wherein: Generating the data element at the current position includes: processing the one or more potential embeddings from the sequence of potential embeddings to generate a score distribution over a set of possible data elements; and The data element at the current position is selected using the score distribution over the set of possible data elements.
10. The method according to claim 9, wherein: Selecting the data element at the current position using the score distribution over the set of possible data elements includes: The data element at the current position is sampled from the set of possible data elements according to the score distribution over the set of possible data elements.
11. A method according to any preceding claim, wherein: For each of the one or more positions in the sequence of positions: The number of potential embeddings in the sequence of potential embeddings is less than the number of data element embeddings in the current sequence of data element embeddings.
12. The method according to claim 11, wherein The number of potential embeddings is at least an order of magnitude smaller than the number of data element embeddings.
13. A method according to any preceding claim, wherein: For each position after the first position in the sequence of positions, the number of potential embeddings in the sequence of potential embeddings is predefined and independent of the number of data element embeddings in the current sequence of data element embeddings.
14. A method according to any preceding claim, wherein: Generating the sequence of data elements includes autoregressively generating the sequence of data elements.
15. A method according to any preceding claim, wherein: The sequence of data elements defines an image.
16. The method according to any one of claims 1 to 14, wherein The sequence of data elements defines an audio waveform.
17. The method according to any one of claims 1 to 14, wherein The sequence of data elements defines a sequence of notes.
18. The method according to any one of claims 1 to 14, wherein The sequence of data elements defines the structure of the protein.
19. The method according to any one of claims 1 to 14, wherein The sequence of data elements defines a video.
20. A method performed by one or more computers, the method comprising: obtaining a representation of the sequence of data elements as a data element embedding sequence, the data element embedding sequence comprising a corresponding data element at each input position in the sequence of input positions; obtaining a sequence of latent embeddings, wherein each latent embedding corresponds to a corresponding position in the sequence of input positions; processing, using a neural network, (i) the sequence of data element embeddings, and (ii) the sequence of latent embeddings to generate, for each output position in the sequence of output positions, a corresponding network output, wherein the neural network comprises a sequence of neural network blocks, the sequence of neural network blocks comprising: (i) a cross-attention block, (ii) one or more self-attention blocks, and (iii) an output block, The cross attention block performs an operation, wherein the operation includes: updating each latent embedding in the sequence of latent embeddings using masked attention on the sequence of data element embeddings; Each self-attention block performs an operation, including: updating each latent embedding in the sequence of latent embeddings using masked attention on the sequence of latent embeddings; and wherein the output block performs operations comprising, after the latent embedding sequence is updated using the criss-cross attention block and the one or more self-attention blocks: For each output position in the sequence of output positions, generating the network output for that output position by processing the corresponding latent embedding from the sequence of latent embeddings.
21. The method according to claim 20, wherein For each potential embedding in the sequence of potential embeddings, updating each potential embedding in the sequence of potential embeddings using masked attention on the sequence of data element embeddings comprises: The latent embedding is updated using attention only on: (i) the data element embedding at the input position corresponding to the latent embedding, and (ii) any data element embeddings at input positions preceding the input position corresponding to the latent embedding.
22. The method according to any one of claims 20 to 21, wherein For each latent embedding in the sequence of latent embeddings, updating each latent embedding in the sequence of latent embeddings using masked attention on the sequence of latent embeddings comprises: The latent embedding is updated using attention on only: (i) the latent embedding, and (ii) any latent embeddings preceding it in the sequence of latent embeddings.
23. The method according to any one of claims 20 to 22, wherein For each potential embedding, obtaining the potential embedding sequence includes: The potential embedding is determined based on the data element embedding at the input position corresponding to the potential embedding.
24. The method according to claim 23, wherein Determining the potential embedding based on the data element embedding at the input position corresponding to the potential embedding comprises: The latent embedding is set equal to the data element embedding at the input position corresponding to the latent embedding.
25. The method according to any one of claims 20 to 24, wherein For each output position in the sequence of output positions, the network output for that output position comprises a distribution of scores over a set of possible data elements.
26. The method according to claim 25, further comprising: determining a gradient of an objective function with respect to a set of neural network parameters of the neural network; as well as The gradient is used to update current values of the set of neural network parameters of the neural network.
27. The method according to claim 26, wherein The objective function measures, for each output position in the sequence of output positions, an error between (i) the score distribution over the set of possible data elements at that output position and (ii) a target data element for that output position.
28. The method according to claim 27, wherein The error includes a cross entropy error.
29. The method according to any one of claims 27 to 28, wherein For each output position before the last output position in the sequence of output positions, the target data element for that output position is the data element at the next input position in the sequence of data elements after the input position corresponding to the latent embedding that was processed to generate the score distribution at that output position.
30. A system comprising: one or more computers; as well as One or more storage devices communicatively coupled to the one or more computers, wherein the one or more storage devices store instructions that, when executed by the one or more computers, cause the one or more computers to perform the operations of the respective method of any one of claims 1 to 29.
31. One or more non-transitory computer storage media storing instructions that, when executed by one or more computers, cause the one or more computers to perform the operations of the respective method of any one of claims 1 to 29.
