Object-centric learning with slot attention
A method involves receiving a perceptual representation including a plurality of feature vectors, and initializing a plurality of slot vectors represented by a neural network memory unit. Each respective slot vector is configured to represent a corresponding entity in the perceptual representation. The method also involves determining an attention matrix based on a product of the plurality of feature vectors transformed by a key function and the plurality of slot vectors transformed by a query function. Each respective value of a plurality of values along each respective dimension of the attention matrix is normalized with respect to the plurality of values. The method additionally involves determining an update matrix based on the plurality of feature vectors transformed by a value function and the attention matrix, and updating the plurality of slot vectors based on the update matrix by way of the neural network memory unit.
1 . A computer-implemented method for generating entity-centric representations for performing downstream tasks, the method comprising:
providing, to a machine learning (ML) model executed by a processor, a plurality of feature vectors comprising N feature vectors that represent features of an input data;
initializing, by the processor, a plurality of slot vectors represented by a neural network memory unit of the ML model and comprising K slot vectors, wherein initializing the plurality of slot vectors comprises determining initial values for the plurality of slot vectors;
determining updated values of the plurality of slot vectors by executing, using the processor, a plurality of iterations of the ML model in which the ML model processes the plurality of feature vectors and the plurality of slot vectors, wherein the plurality of iterations cause each respective slot vector of the plurality of slot vectors to converge to representing a corresponding entity contained in the input data by replacing the initial values with the updated values during the plurality of iterations, and wherein each respective iteration of the plurality of iterations comprises:
determining, using a slot attention calculator of the ML model, an attention matrix based on a product of (i) the plurality of feature vectors transformed by a key function of the ML model and (ii) the plurality of slot vectors transformed by a query function of the ML model, wherein the attention matrix comprises N vectors corresponding to a first dimension of the attention matrix, wherein each respective vector of the N vectors comprises K values corresponding to a second dimension of the attention matrix, and wherein the slot attention calculator normalizes each respective value of the K values of each respective vector of the N vectors of the attention matrix with respect to the K values of the respective vector;
determining, using a slot update calculator of the ML model, an update matrix based on (i) the plurality of feature vectors transformed by a value function of the ML model and (ii) the attention matrix;
updating values of the plurality of slot vectors based on the update matrix and using the neural network memory unit of the ML model, wherein the neural network memory unit provides the updated values of the plurality of slot vectors as input to the query function for a subsequent iteration of the plurality of iterations;
determining, by the ML model executed by the processor, a task-specific output based on the updated values of the plurality of slot vectors; and
performing, using the processor, a downstream task on one or more entities contained in the input data based on the task-specific output.
2 . The computer-implemented method of claim 1 , wherein a respective iteration of the plurality of iterations refines prior values of the respective slot vector towards convergence to representing the corresponding entity contained in the input data, and wherein the prior values of the respective slot vector are determined by a prior iteration that precedes the respective iteration.
3 . The computer-implemented method of claim 1 , wherein each respective slot vector represents a semantic embedding of the corresponding entity, wherein determining the updated values of the plurality of slot vectors (i) iteratively refines the semantic embedding of the corresponding entity and (ii) causes the respective slot vector to converge to representing the corresponding entity independently of a classification of the corresponding entity.
4 . The computer-implemented method of claim 1 , wherein normalizing by the slot attention calculator each respective value of the K values along each respective vector of the N vectors of the attention matrix with respect to the K values of the respective vector comprises using a softmax function to divide (i) an exponent of the respective value of the K values of the respective vector by (ii) a sum of exponents of the K values of the respective vector.
5 . The computer-implemented method of claim 1 , wherein normalizing by the slot attention calculator each respective value of the K values along each respective vector of the N vectors of the attention matrix with respect to the K values of the respective vector causes the plurality of slot vectors to compete with one another for representing entities contained in the input data by causing two or more slot vector of the plurality of slot vectors to attempt to represent a particular entity of the entities.
6 . The computer-implemented method of claim 1 , wherein determining the update matrix comprises:
determining a product of (i) the plurality of feature vectors transformed by the value function and (ii) a transpose of the attention matrix.
7 . The computer-implemented method of claim 1 , wherein determining the update matrix comprises:
determining an attention weight matrix by dividing (i) each respective value of N values of each respective vector of K vectors corresponding to the second dimension of the attention matrix by (ii) a sum of the N values of the respective vector of the K vectors; and
determining a product of (i) the plurality of feature vectors transformed by the value function and (ii) a transpose of the attention weight matrix.
8 . The computer-implemented method of claim 1 , wherein the plurality of feature vectors are represented by an input matrix comprising: (i) N rows corresponding to a number of the plurality of feature vectors and (ii) I columns corresponding to a dimension of each of the plurality of feature vectors, wherein the plurality of slot vectors are represented by a slot matrix comprising: (i) K rows corresponding to a number of the plurality of slot vectors and (ii) S columns corresponding to a dimension of each of the plurality of slot vectors, wherein the key function comprises a linear transformation represented by a key weight matrix comprising I rows and D columns, wherein the query function comprises a linear transformation represented by a query weight matrix comprising S rows and D columns, wherein the value function comprises a linear transformation represented by a value weight matrix comprising I rows and D columns, and wherein one or more of the key weight matrix, the query weight matrix, or the value weight matrix are learned during training.
9 . The computer-implemented method of claim 8 , wherein determining the attention matrix based on the product comprises:
determining a dot product of (i) the plurality of feature vectors transformed by the key function and (ii) a transpose of the plurality of slot vectors transformed by the query function; and
dividing the dot product by a square root of D.
10 . The computer-implemented method of claim 1 , wherein the plurality of slot vectors are permutation equivariant with respect to one another such that, for multiple different initializations of the plurality of slot vectors with respect to a given input data, a set of values of the plurality of slot vectors is approximately constant and an order of the plurality of slot vectors is variable, and wherein the plurality of slot vectors are permutation invariant with respect to the plurality of feature vectors such that, for multiple different permutations of the plurality of feature vector, the set of values of the plurality of slot vectors is approximately constant.
11 . The computer-implemented method of claim 1 , wherein the input data comprises one or more of: image data, depth image data, point cloud data, time series data, audio data, or text data, wherein the input data is processed by way of one or more machine learning models to generate the plurality of feature vectors, and wherein the corresponding entity represented by the respective slot vector comprises one or more of: an object, a surface, a background, a waveform pattern, or one or more words.
12 . The computer-implemented method of claim 1 , wherein each respective feature vector of the plurality of feature vectors comprises a position embedding that indicates a portion of the input data represented by the respective feature vector.
13 . The computer-implemented method of claim 1 , wherein the neural network memory unit comprises at least one of: (i) a gated recurrent unit (GRU) or (ii) a long-short term memory neural network (LSTM), and wherein one or more weights of the neural network memory unit are learned during training.
14 . The computer-implemented method of claim 1 , wherein updating the plurality of slot vectors based on the update matrix by way of the neural network memory unit comprises:
processing the update matrix by way of the neural network memory unit; and
updating the plurality of slot vectors by way of a feed-forward artificial neural network connected to an output of the neural network memory unit.
15 . The computer-implemented method of claim 1 , wherein performing the downstream task comprises:
performing, by one or more machine learning models, at least one of a supervised learning task or an unsupervised learning task based on the task-specific output, wherein the one or more machine learning models are jointly trained with one or more components of the ML model to perform the at least one of the supervised learning task or the unsupervised learning task.
16 . The computer-implemented method of claim 1 , wherein initializing the plurality of slot vectors comprises:
determining the initial values of the plurality of slot vectors based on one or more of: (i) values selected from a normal distribution or (ii) values of one or more preceding slot vectors determined for a preceding input data processed before the input data, wherein initializing the plurality of slot vectors based on the values of the one or more preceding slot vectors causes the plurality of slot vectors to track entities across a sequence of input data.
17 . The computer-implemented method of claim 1 , wherein, when a number of slot vectors in the plurality of slot vectors exceeds a number of entities contained in the input data, values of one or more slot vector of the plurality of slot vectors are configured to indicate that the one or more slot vectors are unused, and wherein, when the number of entities contained in the input data exceeds the number of slot vectors in the plurality of slot vectors, at least one slot vector of the plurality of slot vectors is configured to represent multiple corresponding entities contained in the input data.
18 . A system for generating entity-centric representations for performing downstream tasks, the system comprising:
a processor; and
a non-transitory computer-readable storage medium having stored thereon instruction that, when executed by the processor, cause the processor to perform operations comprising:
providing, to a machine learning (ML) model executed by the processor, a plurality of feature vectors comprising N feature vectors that represent features of an input data;
initializing a plurality of slot vectors represented by a neural network memory unit of the ML model and comprising K slot vectors, wherein initializing the plurality of slot vectors comprises determining initial values for the plurality of slot vectors;
determining updated values of the plurality of slot vectors by executing a plurality of iterations of the ML model in which the ML model processes the plurality of feature vectors and the plurality of slot vectors, wherein the plurality of iterations cause each respective slot vector of the plurality of slot vectors to converge to representing a corresponding entity contained in the input data by replacing the initial values with the updated values during the plurality of iterations, and wherein each respective iteration of the plurality of iterations comprises:
determining, using a slot attention calculator of the ML model, an attention matrix based on a product of (i) the plurality of feature vectors transformed by a key function of the ML model and (ii) the plurality of slot vectors transformed by a query function of the ML model, wherein the attention matrix comprises N vectors corresponding to a first dimension of the attention matrix, wherein each respective vector of the N vectors comprises K values corresponding to a second dimension of the attention matrix, and wherein the slot attention calculator is configured to normalize each respective value of the K values of each respective vector of the N vectors of the attention matrix with respect to the K values of the respective vector;
determining, using a slot update calculator of the ML model, an update matrix based on (i) the plurality of feature vectors transformed by a value function of the ML model and (ii) the attention matrix;
updating values of the plurality of slot vectors based on the update matrix and using the neural network memory unit of the ML model, wherein the neural network memory unit is configured to provide the updated values of the plurality of slot vectors as input to the query function for a subsequent iteration of the plurality of iterations;
determining, by the ML model, a task-specific output based on the updated values of the plurality of slot vectors; and
performing a downstream task on one or more entities contained in the input data based on the task-specific output.
19 . A non-transitory computer-readable storage medium having stored thereon instruction for generating entity-centric representations for performing downstream tasks, the instructions, when executed by a computing system, cause the computing system to perform operations comprising:
providing, to a machine learning (ML) model executed by the computing system, a plurality of feature vectors comprising N feature vectors that represent features of an input data;
initializing a plurality of slot vectors represented by a neural network memory unit of the ML model and comprising K slot vectors, wherein initializing the plurality of slot vectors comprises determining initial values for the plurality of slot vectors;
determining updated values of the plurality of slot vectors by executing a plurality of iterations of the ML model in which the ML model processes the plurality of feature vectors and the plurality of slot vectors, wherein the plurality of iterations cause each respective slot vector of the plurality of slot vectors to converge to representing a corresponding entity contained in the input data by replacing the initial values with the updated values during the plurality of iterations, and wherein each respective iteration of the plurality of iterations comprises:
determining, using a slot attention calculator of the ML model, an attention matrix based on a product of (i) the plurality of feature vectors transformed by a key function of the ML model and (ii) the plurality of slot vectors transformed by a query function of the ML model, wherein the attention matrix comprises N vectors corresponding to a first dimension of the attention matrix, wherein each respective vector of the N vectors comprises K values corresponding to a second dimension of the attention matrix, and wherein the slot attention calculator is configured to normalize each respective value of the K values of each respective vector of the N vectors of the attention matrix is normalized with respect to the K values of the respective vector;
determining, using a slot update calculator of the ML model, an update matrix based on (i) the plurality of feature vectors transformed by a value function of the ML model and (ii) the attention matrix;
updating values of the plurality of slot vectors based on the update matrix and using the neural network memory unit of the ML model, wherein the neural network memory unit is configured to provide the updated values of the plurality of slot vectors as input to the query function for a subsequent iteration of the plurality of iterations;
determining, by the ML model, a task-specific output based on the updated values of the plurality of slot vectors; and
performing a downstream task on one or more entities contained in the input data based on the task-specific output.
20 . The computer-implemented method of claim 1 , wherein the task-specific output represents one or more task-specific attributes of the one or more entities contained in the input data, and wherein performing the downstream task comprises:
causing a device to interact with an environment represented by the input data.