Question: Represent the text to find a very short summary (1-2 sentences max)

Question: We introduce the 2-simplicial Transformer, an extension of the Transformer which includes a form of higher-dimensional attention generalising the dot-product attention, and uses this attention to update entity representations with tensor products of value vectors. We show that this architecture is a useful inductive bias for logical reasoning in the context of deep reinforcement learning. Deep learning contains many differentiable algorithms for computing with learned representations. These representations form vector spaces, sometimes equipped with additional structure. A recent example is the Transformer in which there is a vector space V of value vectors and an inner product space H of query and key vectors. This structure supports a kind of messagepassing, where a value vector v j ∈ V derived from entity j is propagated to update an entity i with weight q i · k j, where q i ∈ H is a query vector derived from entity i, k j ∈ H is a key vector derived from entity j, and the inner product on H is written as a dot product. The Transformer therefore represents a relational inductive bias, where a relation from entity j to entity i is perceived to the extent that q i · k j is large and positive. However, the real world has structure beyond entities and their direct relationships: for example, the three blocks in Figure 1 are arranged in such a way that if either of the supporting blocks is removed, the top block will fall. This is a simple 3-way relationship between entities i, j, k that is complex to represent as a system of 2-way relationships. It is natural to make the hypothesis that such higher-order relationships are essential to extracting the full predictive power of data, across many domains. In accordance with this hypothesis, we introduce a generalisation of the Transformer architecture, the 2-simplicial Transformer, which incorporates both 2-and 3-way interactions. Mathematically, the key observation is that higher-order interactions between entities can be understood using algebras. This is nothing but Boole's insight (Boole, 1847) which set in motion the development of modern logic. In our situation, an appropriate algebra is the Clifford algebra Cl(H) of the space H of queries and keys, which contains that space H ⊆ Cl(H) and in which queries and keys can be multiplied. To represent a 3-way interaction we map each entity i to a triple (p i, l k) using a natural continuous function η: Cl(H) −→ R associated to the Z-grading of Cl(H). This scalar measures how strongly the network perceives a 3-way interaction involving i, j, k. In summary, the 2-simplicial Transformer learns how to represent entities in its environment as vectors v ∈ V, and how to transform those entities to queries and (pairs of) keys in H, so that the signals provided by the scalars q i · k j and η(p i l 1 j l 2 k) are informative about higher-order structure in the environment. As a toy example of higher-order structure, we consider the reinforcement learning problem in a variant of the BoxWorld environment from . The original BoxWorld is played on a rectangular grid populated by keys and locked boxes of varying colours, with the goal being to open the box containing the "Gem". In our variant of the BoxWorld environment, bridge BoxWorld, the agent must use two keys simultaneously to obtain the Gem; this structure in the environment creates many 3-way relationships between entities, including for example the relationship between the locked boxes j, k providing the two keys and the Gem entity i. This structure in the environment is fundamentally logical in nature, and encodes a particular kind of conjunction; see Appendix I. The architecture of our deep reinforcement learning agent largely follows and the details are given in Section 4. The key difference between our simplicial agent and the relational agent of is that in place of a standard Transformer block we use a 2-simplicial Transformer block. Our experiments show that the simplicial agent confers an advantage over the relational agent as an inductive bias in our reasoning task. Motivation from neuroscience for a simplicial inductive bias for abstract reasoning is contained in Appendix J. Our use of tensor products of value vectors is inspired by the semantics of linear logic in vector spaces (; ; ;) in which an algorithm with multiple inputs computes on the tensor product of those inputs, but this is an old idea in natural language processing, used in models including the second-order RNN (; ; ;), multiplicative RNN , Neural Tensor Network and the factored 3-way Restricted Boltzmann Machine , see Appendix A. Tensors have been used to model predicates in a number of neural network architectures aimed at logical reasoning . The main novelty in our model lies in the introduction of the 2-simplicial attention, which allows these ideas to be incorporated into the Transformer architecture. In this section we first review the definition of the ordinary Transformer block and then explain the 2-simplicial Transformer block. We distinguish between the Transformer architecture which contains a word embedding layer, an encoder and a decoder , and the Transformer block which is the sub-model of the encoder that is repeated. The fundamental idea, of propagating information between nodes using weights that depend on the dot product of vectors associated to those nodes, comes ultimately from statistical mechanics via the Hopfield network (Appendix B). The ordinary and 2-simplicial Transformer blocks define operators on sequences e 1,..., e N of entity representations. Strictly speaking the entities are indices 1 ≤ i ≤ N but we sometimes identify the entity i with its representation e i. The space of entity representations is denoted V, while the space of query, key and value vectors is denoted H. We use only the vector space structure on V, but H = R d is an inner product space with the usual dot product pairing (h, h) → h · h and in defining the 2-simplicial Transformer block we will use additional algebraic structure on H, including the "multiplication" tensor B: H ⊗ H −→ H of (used to propagate tensor products of value vectors) and the Clifford algebra of H (used to define the 2-simplicial attention). In the first step of the standard Transformer block we generate from each entity e i a tuple of vectors via a learned linear transformation E: V −→ H ⊕3. These vectors are referred to respectively as query, key and value vectors and we write Stated differently, In the second step we compute a refined value vector for each entity Finally, the new entity representation e i is computed by the application of a feedforward network g θ, layer normalisation and a skip connection Remark 2.1. In the introduction we referred to the idea that a Transformer model learns representations of relations. To be more precise, these representations are heads, each of which determines an independent set of transformations W Q, W K, W V which extract queries, keys and values from entities. Thus a head determines not only which entities are related (via W Q, W K) but also what information to transmit between them (via W V). In multiple-head attention with K heads, there are K channels along which to propagate information between every pair of entities, each of dimension dim(H)/K. More precisely, we choose a decomposition H = H 1 ⊕ · · · ⊕ H K so that and write To compute the output of the attention, we take a direct sum of the value vectors propagated along every one of these K channels, as in the formula In combinatorial topology the canonical one-dimensional object is the 1-simplex (or edge) j −→ i. Since the standard Transformer model learns representations of relations, we refer to this form of attention as 1-simplicial attention. The canonical two-dimensional object is the 2-simplex (or triangle) which we may represent diagrammatically in terms of indices i, j, k as In the 2-simplicial Transformer block, in addition to the 1-simplicial contribution, each entity e i is updated as a function of pairs of entities e j, e k using the tensor product of value vectors u j ⊗ u k and a probability distribution derived from a scalar triple product p i, l 1 j, l 2 k in place of the scalar product q i · k j. This means that we associate to each entity e i a four-tuple of vectors via a learned linear transformation E: V −→ H ⊕4, denoted We still refer to p i as the query, l 1 i, l 2 i as the keys and u i as the value. Stated differently, whose square is a polynomial in the pairwise dot products This scalar triple product has a simple geometric interpretation in terms of the volume of the tetrahedron with vertices 0, a, b, c. To explain, recall that the triangle spanned by two unit vectors a, b in R 2 has an area A which can be written in terms of the dot product of a and b. In three dimensions, the analogous formula involves the volume V of the tetrahedron with vertices given by unit vectors a, b, c, and the scalar triple product as shown in Figure 2. In general, given nonzero vectors a, b, c letâ,b,ĉ denote unit vectors in the same directions. Then we can by Lemma C.10(v) factor out the length in the scalar triple product Figure 2: The geometry of 1-and 2-simplicial attention. Left: the dot product in terms of the area A in R 2. Right: the triple product in terms of the volume V in R 3. so that a general scalar triple product can be understood in terms of the vector norms and configurations of three points on the 2-sphere. One standard approach to calculating volumes of such tetrahedrons is the cross product which is only defined in three dimensions. Since the space of representations H is high dimensional the natural framework for the triple scalar product a, b, c is instead the Clifford algebra of H (see Appendix C). For present purposes, we need to know that a, b, c attains its minimum value (which is zero) when a, b, c are pairwise orthogonal, and attains its maximum value (which is a b c) if and only if {a, b, c} is linearly dependent (Lemma C.10). Using the number p i, l k as a measure of the degree to which entity i is attending to (j, k), or put differently, the degree to which the network predicts the existence of a 2-simplex (i, j, k), the update rule for the entities when using purely 2-simplicial attention is where B: H ⊗ H −→ H is a learned linear transformation. Although we do not impose any further constraints, the motivation here is to equip H with the structure of an algebra; in this respect we model conjunction by multiplication, an idea going back to Boole (Boole, 1847). We compute multiple-head 2-simplicial attention in the same way as in the 1-simplicial case. To combine 1-simplicial heads (that is, ordinary Transformer heads) and 2-simplicial heads we use separate inner product spaces H 1, H 2 for each simplicial dimension, so that there are learned linear transformations ⊕4 and the queries, keys and values are extracted from an entity e i according to The update rule (for a single head in each simplicial dimension) is then: If there are K 1 heads of 1-simplicial attention and K 2 heads of 2-simplicial attention, then is modified in the obvious way using Without the additional layer normalisation on the output of the 2-simplicial attention we find that training is unstable. The natural explanation is that these outputs are constructed from polynomials of higher degree than the 1-simplicial attention, and thus computational paths that go through the 2-simplicial attention will be more vulnerable to exploding or vanishing gradients. The time complexity of 1-simplicial attention as a function of the number of entities is O(N 2) while the time complexity of 2-simplicial attention is O(N 3) since we have to calculate the attention for every triple (i, j, k) of entities. For this reason we consider only triples (i, j, k) where the base of the 2-simplex (j, k) is taken from a set of pairs predicted by the ordinary attention, which we view as the primary locus of computation. More precisely, we introduce in addition to the N entities (now referred to as standard entities) a set of M virtual entities e N +1,..., e N +M. These virtual entities serve as a "scratch pad" onto which the iterated ordinary attention can write representations, and we restrict j, k to lie in the range N < j, k ≤ N + M so that only value vectors obtained from virtual entities are propagated by the 2-simplicial attention. With virtual entities the update rule is for and for The updated representation e i is computed from v i, e i using as before. Observe that the virtual entities are not used to update the standard entities during 1-simplicial attention and the 2-simplicial attention is not used to update the virtual entities; instead the second summand in involves the vector u i = W U e i, which adds recurrence to the update of the virtual entities. After the attention phase the virtual entities are discarded. The method for updating the virtual entities is similar to the role of the memory nodes in the relational recurrent architecture of , the master node in (, §5.2) and memory slots in the Neural Turing Machine . The update rule has complexity O(N M 2) and so if we take M to be of order √ N we get the desired complexity O(N 2). The environment in our reinforcement learning problem is a variant of the BoxWorld environment from . The standard BoxWorld environment is a rectangular grid in which are situated the player (a dark gray tile) and a number of locked boxes represented by a pair of horizontally adjacent tiles with a tile of colour x, the key colour, on the left and a tile of colour y, the lock colour, on the right. There is also one loose key in each episode, which is a coloured tile not initially adjacent to any other coloured tile. All other tiles are blank (light gray) and are traversable by the player. The rightmost column of the screen is the inventory, which fills from the top and contains keys that have been collected by the player. The player can pick up any loose key by walking over it. In order to open a locked box, with key and lock colours x, y, the player must step on the lock while in possession of a copy of y, in which case one copy of this key is removed from the inventory and replaced by a key of colour x. The goal is to attain a white key, referred to as the Gem (represented by a white square) as shown in the sample episode of Figure 3. In this episode, there is a loose pink key (marked 1) which can be used to open one of two locked boxes, obtaining in this way either key 5 or key 2 1. The correct choice is 2, since this leads via the sequence of keys 3, 4 to the Gem. Some locked boxes, if opened, provide keys that are not useful for attaining the Gem. Since each key may only be used once, opening such boxes means the episode is rendered unsolvable. Such boxes are called distractors. An episode ends when the player either obtains the Gem (with a reward of +10) or opens a distractor box (reward −1). Opening any non-distractor box, or picking up a loose key, garners a reward of +1. The solution length is the number of locked boxes (including the one with the Gem) in the episode on the path from the loose key to the Gem. Our variant of the BoxWorld environment, bridge BoxWorld, is shown in Figure 4. In each episode two keys are now required to obtain the Gem, and there are therefore two loose keys on the board. To obtain the Gem, the player must step on either of the lock tiles with both keys in the inventory, at which point the episode ends with the usual +10 reward. Graphically, Gems with multiple locks are denoted with two vertical white tiles on the left, and the two lock tiles on the right. Two solution 1 The agent sees only the colours of tiles, not the numbers which are added here for exposition. paths (of the same length) leading to each of the locks on the Gem are generated with no overlapping colours, beginning with two loose keys. In episodes with multiple locks we do not consider distractor boxes of the old kind; instead there is a new type of distractor that we call a bridge. This is a locked box whose lock colour is taken from one solution branch and whose key colour is taken from the other branch. Opening the bridge renders the puzzle unsolvable. An episode ends when the player either obtains the Gem (reward +10) or opens the bridge (reward −1). Opening a box other than the bridge, or picking up a loose key, has a reward of +1 as before. In this paper we consider episodes with zero or one bridge (the player cannot fail to solve an episode with no bridge). Standard BoxWorld is straightforward for an agent to solve using relational reasoning, because leaves on the solution graph can be identified (their key colour appears only once on the board) and by propagating this information backwards along the arrows on the solution graph, an agent can identify distractors. Bridge BoxWorld emphasises reasoning about 3-way relationships (or 2-simplices). The following 2-simplex motifs appear in all solution graphs where a pair of boxes (α, β) is a source if they have the same lock colour but distinct key colours, and a sink if they have the same key colour but distinct lock colours (the 2-simplex leading to the Gem being an example). If α, β is a source or a sink then either α is the bridge or β is the bridge. If the agent can observe both a source and a sink then it can locate the bridge. It is less clear how to identify bridges using iterated relational reasoning, because every path in the solution graph eventually reaches the Gem. Our baseline relational agent is modeled closely on except that we found that a different arrangement of layer normalisations worked better in our experiments, see Remark 4.1. The code for our implementation of both agents is available online . In the following we describe the network architecture of both the relational and simplicial agent; we will note the differences between the two models as they arise. The input to the agent's network is an RGB image, represented as a tensor of shape where R is the number of rows and C the number of columns (the C + 1 is due to the inventory). This tensor is divided by 255 and then passed through a 2 × 2 convolutional layer with 12 features, and then a 2 × 2 convolutional layer with 24 features. Both activation functions are ReLU and the padding on our convolutional layers is "valid" so that the output has shape [R − 2, C − 1, 24]. We then multiply by a weight matrix of shape 24 × 62 to obtain a tensor of shape [R − 2, C − 1, 62]. Each feature vector has concatenated to it a twodimensional positional encoding, and then the is reshaped into a tensor of shape [N, 64] where N = (R − 2)(C − 1) is the number of Transformer entities. This is the list (e 1, . . ., e N) of entity representations e i ∈ V = R 64. In the case of the simplicial agent, a further two learned embedding vectors e N +1, e N +2 are added to this list; these are the virtual entities. So with M = 0 in the case of the relational agent and M = 2 for the simplicial agent, the entity representations form a tensor of shape [N + M, 64]. This tensor is then passed through two iterations of the Transformer block (either purely 1-simplicial in the case of the relational agent, or including both 1 and 2-simplicial attention in the case of the simplicial agent). In the case of the simplicial agent the virtual entities are then discarded, so that in both cases we have a sequence of entities e 1,..., e N. Inside each block are two feedforward layers separated by a ReLU activation with 64 hidden nodes; the weights are shared between iterations of the Transformer block. In the 2-simplicial Transformer block the input tensor, after layer normalisation, is passed through the 2-simplicial attention and the (after an additional layer normalisation) is concatenated to the output of the 1-simplicial attention heads before being passed through the feedforward layers. The pseudo-code for the ordinary and 2-simplicial Transformer blocks are: d e f t r a n s f o r m e r b l o c k (e): x = LayerNorm (e) a = 1 S i m p l i c i a l A t t e n t i o n (x) b = D e n s e L a y e r 1 (a) c = D e n s e L a y e r 2 (b) r = Add ([ e, c] ) e p r i m e = LayerNorm (r) r e t u r n e p r i m e d e f s i m p l i c i a l t r a n s f o r m e r b l o c k (e): x = LayerNorm (e) a1 = 1 S i m p l i c i a l A t t e n t i o n (x) a2 = 2 S i m p l i c i a l A t t e n t i o n (x) a2n = LayerNorm (a2) a c = C o n c a t e n a t e ([ a1, a2n] ) b = D e n s e L a y e r 1 (a c) c = D e n s e L a y e r 2 (b) r = Add ([ e, c] ) e p r i m e = LayerNorm (r) r e t u r n e p r i m e Our implementation of the standard Transformer block is based on an implementation in Keras from . In both the relational and simplicial agent, the space V of entity representations has dimension 64 and we denote by H 1, H 2 the spaces of 1-simplicial and 2-simplicial queries, keys and values. In both the relational and simplicial agent there are two heads of 1-simplicial attention, In the simplicial agent there is a single head of 2-simplicial attention with dim(H 2) = 48 and two virtual entities. The output of the Transformer blocks is a tensor of shape [N, 64]. To this final entity tensor we apply max-pooling over the entity dimension, that is, we compute a vector v ∈ R 64 by the rule v i = max 1≤j≤N (e j) i for 1 ≤ i ≤ 64. This vector v is then passed through four fully-connected layers with 256 hidden nodes and ReLU activations. The output of the final fully-connected layer is multiplied by one 256 × 4 weight matrix to produce logits for the actions (left, up, right and down) and another 256 × 1 weight matrix to produce the value function. Remark 4.1. There is wide variation in the layer normalisation in Transformer models, compare (; ;). In layer normalisation occurs in two places: on the concatenation of the Q, K, V matrices, and on the output of the feedforward network g θ. We keep this second normalisation but move the first from after the linear transformation E of to before this linear transformation, so that it is applied directly to the incoming entity representations. This ordering gave the best performant relational model in our experiments, with our diverging even further if a direct comparison to the architecture was used. The training of our agents uses the implementation in Ray RLlib of the distributed off-policy actor-critic architecture IMPALA of with optimisation algorithm RMSProp. The hyperparameters for IMPALA and RMSProp are given in Table 1 of Appendix E. Following and other recent work in deep reinforcement learning, we use RMSProp with a large value of the hyperparameter ε = 0.1. As we explain in Appendix G, this is effectively RMSProp with smoothed gradient clipping. First we verified that our implementation of the relational agent solves the BoxWorld environment with a solution length sampled from and number of distractors sampled from on a 9 × 9 grid. After training for 2.35 × 10 9 timesteps our implementation solved over 93% of puzzles (regarding the discrepancy with the reported sample complexity in see Appendix D). Next we trained the relational and simplicial agent on bridge BoxWorld, under the following conditions: half of the episodes contain a bridge, the solution length is uniformly sampled from (both solution paths are of the same length), colours are uniformly sampled from a set of 20 colours and the boxes and loose keys are arranged randomly on a 7 × 9 grid, under the constraint that the box containing the Gem does not occur in the rightmost column or bottom row, and keys appear only in positions (y, x) = (2r, 3c − 1) for 1 ≤ r ≤ 3, 1 ≤ c ≤ 3. The starting and ending point of the bridge are uniformly sampled with no restrictions (e.g. the bridge can involve the colours of the loose keys and locks on the Gem) but the lock colour is always on the top solution path. There is no curriculum and no cap on timesteps per episode. We trained four independent trials of both agents to either 5.5 × 10 9 timesteps or convergence, whichever came first. In Figure 6 we give the mean and standard deviation of these four trials, showing a clear advantage of the simplicial agent. We make some remarks about performance comparisons taking into account the fact that the relational agent is simpler (and hence faster to execute) than the simplicial agent in Appendix D. The training runs for the relational and simplicial agents are shown in Figure 9 and Figure 10 of Appendix F, together with analysis and visualization of the 1-and 2-simplicial attention in specific examples. In the reported experiments we use only two Transformer blocks; we performed two trials of a relational agent using four Transformer blocks, but after 5.5 × 10 9 timesteps neither trial exceeded the 0.85 plateau in terms of fraction solved. Our overall therefore suggest that the 2-simplicial Transformer is more powerful than the standard Transformer, with its performance not matched by adding greater depth. This is further supported by the fact on a time-adjusted basis, the 2-simplicial model still converges faster than the ordinary model; see Figure 8 of Appendix D. We analyse the simplicial agent to establish that it has learned to use the 2-simplicial attention, and to provide some intuition for why 2-simplices are useful; additional details are in Appendix F. The analysis is complicated by the fact that our 2 × 2 convolutional layers (of which there are two) are not padded, so the number of entities processed by the Transformer blocks is (R − 2)(C − 1) where the original game board is R × C and there is an extra column for the inventory (here R is the number of rows). This means there is not a one-to-one correspondence between game board tiles and entities; for example, all the experiments reported in Figure 6 are on a 7 × 9 board, so that there are N = 40 Transformer entities which can be arranged on a 5 × 8 grid (information about this grid is passed to the Transformer blocks via the positional encoding). Nonetheless we found that for trained agents there is a strong relation between a tile in position (y, x) and the Transformer entity with index This correspondence is presumed in the following analysis, and in our visualisations. Displayed in Figure 7 are attention distributions for simplicial agent A of Figure 10. The four images in the top right show the ordinary attention of the virtual entities in the first iteration of the simplicial Transformer block: in the first head, the first virtual entity attends strongly to a particular lock, while the second head of the second virtual entity attends strongly to the corresponding key. Shown at the bottom of Figure 7 is the 2-simplicial attention in the second iteration of the simplicial Transformer block. The columns are query entities i and rows are key entity pairs (j, k) in lexicographic order,,,. Entity 17 is the top lock on the Gem, 25 is the bottom lock on the Gem, 39 is the player. We may therefore infer, from our earlier description of the ordinary attention of the virtual entities, that the agent "perceives" the 2-simplex with query entity 25 as shown. In general we observe that the top and bottom locks on the Gem, the player, and the entities 7, 15 associated to the inventory often have a non-generic 2-simplicial attention, which strongly suggests that the simplicial agent has learned to use 2-simplices in a meaningful way. Figure 7: Visualization of 2-simplicial attention in step 18 of an episode. On general grounds one might expect that in the limit of infinite experience, any reinforcement learning agent with a sufficiently deep neural network will be able to solve any environment, in-cluding those like bridge BoxWorld that involve higher-order relations between entities. In practice, however, we do not care about the infinite computation limit. In the regime of bounded computation it is reasonable to introduce biases towards learning representations of structures that are found in a wide range of environments that we consider important. We argue that higher-order relations between entities are an important example of such structures, and that the 2-simplicial Transformer is a natural inductive bias for 3-way interactions between entities. We have given preliminary evidence for the utility of this bias by showing that in the bridge BoxWorld environment the simplicial agent has better performance than a purely relational agent, and that this performance involves in a meaningful way the prediction of 3-way interactions (or 2-simplices). We believe that simplicial Transformers may be useful for any problem in which higher-order relations between entities are important. The long history of interactions between logic and algebra is a natural source of inspiration for the design of inductive biases in deep learning. In this paper we have exhibited one example: Boole's idea, that relationships between entities can be modeled by multiplication in an algebra, may be realised in the context of deep learning as an augmentation to the Transformer architecture using Clifford algebras of spaces of representations. The Transformer model and descendents such as the Universal Transformer can be viewed as general units for computing with learned representations; in this sense they have a similar conceptual role to the Neural Turing Machine (NTM) and Differentiable Neural Computer . As pointed out in (, §4) one can view the Transformer as a block of parallel RNNs (one for each entity) which update their hidden states at each time step by attending to the sequence of hidden states of the other RNNs at the previous step. We expand on those remarks here in order to explain the connection between the 2-simplicial Transformer and earlier work in the NLP literature, which is written in terms of RNNs. We consider a NTM with content-based addressing only and no sharpening. The core of the NTM is an RNN controller with update rule where W, U, b are weight matrices, x is the current input symbol, h is the previous hidden state, h is the next hidden state and M is the output of the memory read head where there are N memory slots containing M 1,... M N, q is a query generated from the hidden state of the RNN by a weight matrix q = Zh, and We omit the mechanism for writing to the memory here, since it is less obvious how that relates to the Transformer; see (, §3.2). Note that while we can view M j as the "hidden state" of memory slot j, the controller's hidden state and the hidden states of the memory slots play asymmetric roles, since the former is updated with a feedforward network at each time step, while the latter is not. The Transformer with shared transition functions between layers is analogous to a NTM with this asymmetry removed: there is no longer a separate recurrent controller, and every memory slot is updated with a feedforward network in each timestep. To explain, view the entity representations e 1,..., e N of the Transformer as the hidden states of N parallel RNNs. The new representation is where the attention term is and q i = Ze i is a query vector obtained by a weight matrix from the hidden state, the k j = Ke j are key vectors and v j = V e j is the value vector. Note that in the Transformer the double role of M j in the NTM has been replaced by two separate vectors, the key and value, and the cosine similarity K[−, −] has been replaced by the dot product. Having now made the connection between the Transformer and RNNs, we note that the second-order RNN (; ; ;) and the similar multiplicative RNN have in common that the update rule for the hidden state of the RNN involves a term V (x ⊗ h) which is a linear function of the tensor product of the current input symbol x and the current hidden state h. One way to think of this is that the weight matrix V maps inputs x to linear operators on the hidden state. In the update rule contains a term V (e 1 ⊗ e 2) where e 1, e 2 are entity vectors, and this is directly analogous to our construction. The continuous Hopfield network (, Ch.42) with N nodes updates in each timestep a sequence of vectors by the rules for some parameter η. The Transformer block may therefore be viewed as a refinement of the Hopfield network, in which the three occurrences of entity vectors in are replaced by query, key and value vectors W Q e i, W K e j, W V e j respectively, the nonlinearity is replaced by a feedforward network with multiple layers, and the dynamics are stabilised by layer normalisation. The initial representations e i also incorporate information about the underlying lattice, via the positional embeddings. The idea that the structure of a sentence acts to transform the meaning of its parts is due to Frege (Frege, 1892) and underlies the denotational semantics of logic. From this point of view the Transformer architecture is an inheritor both of the logical tradition of denotational semantics, and of the statistical mechanics tradition via Hopfield networks. The volume of an n-simplex in R n with vertices at 0, v 1,..., v n is which is 1 n! times the volume of the n-dimensional parallelotope which shares n edges with the nsimplex. In our applications the space of representations H is high dimensional, but we wish to speak of the volume of k-simplices for k < dim(H) and use those volumes to define the coefficients of our simplicial attention. The theory of Clifford algebras is one appropriate framework for such calculations. Let H be an inner product space with pairing (v, w) → v · w. The Clifford algebra Cl(H) is the associative unital R-algebra generated by the vectors v ∈ H with relations vw + wv = 2(v · w) · 1. The canonical k-linear map H −→ Cl(H) is injective, and since v 2 = v 2 · 1 in Cl(H), any nonzero vector v ∈ H is a unit in the Clifford algebra. While as an algebra Cl(H) is only Z 2 -graded, there is nonetheless a Z-grading of the underlying vector space which can be defined as follows: let {e i} n i=1 be an orthonormal basis of H, then the set is a basis for Cl(H), with m ranging over the set {0, . . ., n}. If we assign the basis element e i1 · · · e im the degree m, then this determines a Z-grading [−] k of the Clifford algebra which is easily checked to be independent of the choice of basis. Definition C.1. [A] k denotes the homogeneous component of A ∈ Cl(H) of degree k. There is an operation on elements of the Clifford algebra called reversion in geometric algebra (, p.45) which arises as follows: the opposite algebra Cl(H) op admits a k-linear map j: H −→ Cl(H) op with j(v) = v which satisfies j(v)j(w) + j(w)j(v) = 2(v · w) · 1, and so by the universal property there is a unique morphism of algebras op which restricts to the identity on H..., v k ∈ H and (−) † is homogeneous of degree zero with respect to the Z-grading. Using this operation we can define the magnitude (, p.46) of any element of the Clifford algebra. and in particular for v ∈ H we have |v| = v. Lemma C.4. Set n = dim(H). Then for A ∈ Cl(H) we have Proof. See (, Chapter 2 (1.33)). Example C.5. For a, b, c ∈ H the lemma gives Remark C.6. Given vectors v 1,..., v k ∈ H the wedge product v 1 ∧ · · · ∧ v k is an element in the exterior algebra H. Using the chosen basis B we can identify the underlying vector space of Cl(H) with H and using this identification (set where S k is the permutation group on k letters. That is, the top degree piece of v 1 · · · v k in Cl(H) is always the wedge product. It is then easy to check that the squared magnitude of this wedge product is The term in the innermost bracket is the determinant of the k × k submatrix with columns j = (j 1, . . ., j k) and in the special case where k = n = dim(H) we see that the squared magnitude is just the square of the determinant of the matrix (λ ij) 1≤i,j≤n. The wedge product of k-vectors in H can be thought of as an oriented k-simplex, and the magnitude of this wedge product in the Clifford algebra computes the volume. Definition C.7. The volume of a k-simplex in H with vertices 0, v 1,..., v k is Definition C.8. Given v 1,..., v k ∈ H the k-fold unsigned scalar product is By Lemma C.4 and we have which gives the desired generalisation of the equations in Figure 2. Example C.9. For k = 2 the unsigned scalar product is the absolute value of the dot product, a, b = |a · b|. For k = 3 we obtain the formulas of Definition 2.2, from which it is easy to check that a, b, c = a b c cos 2 θ ab + cos 2 θ bc + cos 2 θ ac − 2 cos θ ab cos θ ac cos θ bc where θ ac, θ ab, θ ac are the angles between a, b, c. The geometry of the three-dimensional case is more familiar: if dim(H) = 3 then |[abc] 3 | is the absolute value of the determinant by, so that Vol 3 = With these formulas in mind the geometric content of the following lemma is clear: (ii) If the v i are all pairwise orthogonal then v 1,..., v k = 0. (iii) The set {v 1, . . ., v k} is linearly dependent if and only if v 1,..., (v) For λ 1,..., λ k ∈ R, we have For more on simplicial methods in the context of geometric algebra see (; The experiments in the original BoxWorld paper contain an unreported cap on timesteps per episode (an episode horizon) of 120 timesteps . We have chosen to run our experiments without an episode horizon, and since this means our reported sample complexities diverge substantially from the original paper (some part of which it seems reasonable to attribute to the lack of horizon) it is necessary to justify this choice. When designing an architecture for deep reinforcement learning the goal is to reduce the expected generalisation error (, §8.1.1) with respect to some class of similar environments. Although this class is typically difficult to specify and is often left implicit, in our case the class includes a range of visual logic puzzles involving spatial navigation, which can be solved without memory 2. A learning curriculum undermines this goal, by making our expectations of generalisation conditional on the provision of a suitable curriculum, whose existence for a given member of the problem class may not be clear in advance. The episode horizon serves as a de facto curriculum, since early in training it biases the distribution of experience rollouts towards the initial problems that an agent has to solve (e.g. learning to pick up the loose key). In order to avoid compromising our ability to expect generalisation to similar puzzles which do not admit such a useful curriculum, we have chosen not to employ an episode horizon. Fortunately, the relational agent performs well even without a curriculum on the original BoxWorld, as our show. In Figure 6 of Section 5, the horizontal axis was environment steps. However, since the simplicial agent has a more complex model, each environment step takes longer to execute and the gradient descent steps are slower. In a typical experiment run on the GCP configuration, the training throughput of the relational agent is 1.9 × 10 4 environment frames per second (FPS) and that of the simplicial agent is 1.4 × 10 4 FPS. The relative performance gap decreases as the GPU memory and the number of IMPALA workers are increased, and this is consistent with the fact that the primary performance difference appears to be the time taken to compute the gradients (35ms vs 80ms). In Figure 8 we give the time-adjusted performance of the simplicial agent (the graph for the relational agent is as before) where the x-axis of the graph of the simplicial agent is scaled by 1.9/1.4. In principle there is no reason for a significant performance mismatch: the 2-simplicial attention can be run in parallel to the ordinary attention (perhaps with two iterations of the 1-simplicial attention per iteration of the 2-simplicial attention) so that with better engineering it should be possible to reduce this gap. 2 The bridge is the unique box both of whose colours appear three times on the board. However, this is not a reliable strategy for detecting bridges for an agent without memory, because once the agent has collected some of the keys on the board, some of the colours necessary to make this deduction may no longer be present. Our experiments involve only a small number of virtual entities, and a small number of iterations of the Transformer block: it is possible that for large numbers of virtual entities and iterations, our choices of layer normalisation are not optimal. Our aim was to test the viability of the simplicial Transformer starting with the minimal configuration, so we have also not tested multiple heads of 2-simplicial attention. Deep reinforcement learning is notorious for poor reproducibility , and in an attempt to follow the emerging best practices we are releasing our agent and environment code, trained agent weights, and training notebooks . The training runs for the relational and simplicial agents are shown in Figure 9 and Figure 10 respectively. In this Appendix we provide further details relating to the analysis of the attention of the trained simplicial agent in Section 6. Across our four trained simplicial agents, the roles of the virtual entities and heads vary: the following comments are all in the context of the best simplicial agent (simplicial agent A of Figure 10) but we observe similar patterns in the other trials. The standard entities are now indexed by 0 ≤ i ≤ 39 and virtual entities by i = 40, 41. In the first iteration of the 2-simplicial Transformer block, the first 1-simplicial head appears to propagate information about the inventory. At the beginning of an episode the attention of each standard entity is distributed between entities 7, 15, 23, 31 (the entities in the rightmost column), it concentrates sharply on 7 (the entity closest to the first inventory slot) after the acquisition of the first loose key, and sharply on 7, 15 after the acquisition of the second loose key. The second 1-simplicial head seems to acquire the meaning described in , where tiles of the same colour attend to one another. A typical example is shown in Figure 11. The video of this episode is available online . Figure 11: Visualisation of 1-simplicial attention in first Transformer block, between standard entities in heads one and two. The vertical axes on the second and third images are the query index 0 ≤ i ≤ 39, the horizontal axes are the key index 0 ≤ j ≤ 39. The standard entities are updated using 2-simplices in the first iteration of the 2-simplicial Transformer block, but this is not interesting as initially the virtual entities are learned embedding vectors, containing no information about the current episode. So we restrict our analysis to the 2-simplicial attention in the second iteration of the Transformer block. For the analysis, it will be convenient to organise episodes of bridge BoxWorld by their puzzle type, which is the tuple (a, b, c) where 1 ≤ a ≤ 3 is the solution length, 1 ≤ b ≤ a is the bridge source and a + 1 ≤ c ≤ 2a is the bridge target, with indices increasing with the distance from the gem. The episodes in Figures 4 and 7 have type. Figure 12: Visualisation of the 2-simplicial attention in the second Transformer block in step 13 of an episode of puzzle type. Entity 1 is the top lock on the Gem, 15 is associated with the inventory, 36 is the lock directly below the player. Shown is a 2-simplex with target 15. Figure 13: Visualisation of the 2-simplicial attention in the second Transformer block in step 29 of an episode of puzzle type. Entity 7 is associated with the inventory, 17 is the player. Shown is a 2-simplex with target 17. To give more details we must first examine the content of the virtual entities after the first iteration, which is a function of the 1-simplicial attention of the virtual entities in the first iteration. In Figures 7, 12, 13 we show these attention distributions multiplied by the pixels in the region [1, R − 2] × [1, C − 1] of the original board, in the second and third columns of the second and third rows. Let f 1 = e 40 and f 2 = e 41 denote the initial representations of the first and second virtual entities, before the first iteration. We use the index z ∈ {1, 2} to stand for a virtual entity. In the first iteration the representations are updated by to where the sum is over all entities α, the a z α are the attention coefficients of the first 1-simplicial head and the coefficients b z α are the attention of the second 1-simplicial head. Writing 0 1, 0 2 for the zero vector in H 1 1, H 1 2 respectively, this can be written as For a query entity i the vector propagated by the 2-simplicial part of the second iteration has the following terms, where Here A i j,k is the 2-simplicial attention with logits p i, l ) is the ith column in our visualisations of the 2-simplicial attention, so in the situation of Figure 7 with i = 25 we have A 25 1,2 ≈ 1 and hence the output of the 2-simplicial head used to update the entity representation of the bottom lock on the Gem is approximately B(f 1 ⊗ f 2). If we ignore the layer normalisation, feedforward network and skip connection in then f 1 ≈ v 1 ⊕ 0 2 and f 2 ≈ 0 1 ⊕ v 0 so that the output of the 2-simplicial head with target i = 25 is approximately Following Boole (Boole, 1847) and Girard it is natural to read the "product" as a conjunction (consider together the entity 1 and the entity 0) and the sum in as a disjunction. An additional layer normalisation is applied to this vector, and the is concatenated with the incoming information for entity 25 from the 1-simplicial attention, before all of this is passed through to form e 25. Given that the output of the 2-simplicial head is the only nontrivial difference between the simplicial and relational agent (with a transformer depth of two, the first 2-simplicial Transformer block only updates the standard entities with information from embedding vectors) the performance differences reported in Figure 6 suggest that this output is informative about avoiding bridges. In the training curves of the agents of Figure 9 and Figure 10 we observe a common plateau at a win rate of 0.85. In Figure 14 we show the per-puzzle win rate of simplicial agent A and relational agent A, on puzzles. These graphs make clear that the transition of both agents to the plateau at 0.85 is explained by solving the type (and to a lesser degree by progress on all puzzle types with b = 1). In Figure 14 and Figure 15 we give the per-puzzle win rates for a small sample of other puzzle types. Shown are the mean and standard deviation of 100 runs across various checkpoints of simplicial agent A and relational agent A. As originally presented in the optimisation algorithm RMSProp is a mini-batch version of Rprop, where instead of dividing by a different number in every mini-batch 3, 3, 5),. (namely, the absolute value of the gradient) we force this number to be similar for adjacent minibatches by keeping a moving average of the square of the gradient. In more detail, one step Rprop is computed by the algorithm κ is the learning rate, x i is a weight, g i is the associated gradient and ε is a small constant (the TensorFlow default value is 10 −10) added for numerical stability. The idea of Rprop is to update weights using only the sign of the gradient: every weight is updated by the same absolute amount κ in each step, with only the sign g i / √ r i = g i /|g i | of the update varying with i. The algorithm RMSprop was introduced as a refinement of Rprop: p is the decay rate (in our experiments the value is 0.99). Clearly Rprop is the p → 0 limit of RMSprop. For further see (, §8.5 In recent years there has been a trend in the literature towards using RMSprop with large values of the hyperparameter ε. For example in RMSProp is used with ε = 0.1, which is also one of the range of values in (, . This "large ε RMSProp" seems to have originated in (, §8). To understand what large ε RMSProp is doing, let us rewrite the algorithm as where S is the sigmoid S(u) = u/ √ 1 + u 2 which asymptotes to 1 as u → +∞ and is wellapproximated by the identity function for small u. We see a new multiplicative factor S(r i /ε) in the optimisation algorithm. Note that √ r i is a moving average of |g i |. Recall the original purpose of Rprop was to update weights using only the sign of the gradient and the learning rate, namely κg i / √ r i. The new S factor in the above reinserts the size of the gradient, but scaled by the sigmoid to be in the unit interval. In the limit ε → 0 we squash the outputs of the sigmoid up near 1 and the standard conceptual description of RMSProp applies. But as ε → 1 the sigmoid S(√ r i) has the effect that for large stable gradients we get updates of size κ and for small stable gradients we get updates of the same magnitude as the gradient. In , large ε RMSprop is a form of RMSprop with smoothed gradient clipping (, §10.11.1). It is no simple matter to define logical reasoning nor to recognise when an agent (be it an animal or a deep reinforcement learning agent) is employing such reasoning . We therefore begin by returning to Aristotle, who viewed logic as the study of general patterns by which one could distinguish valid and invalid forms of philosophical argumentation; this study having as its purpose the production of strategies for winning such argumentation games (; ;). In this view, logic involves • two players with one asserting the truth of a proposition and attempting to defend it, and the latter asserting its falsehood and attempting to refute it, and an • observer attempting to learn the general patterns which are predictive of which of the two players will win such a game given some intermediate state. Suppose we observe over a series of games 4 that a player is following an explicit strategy which has been distilled from general patterns observed in a large distribution of games, and that by following this strategy they almost always win. A component of that explicit strategy can be thought of as logical reasoning to the degree that it consists of rules that are independent of the particulars of the game (, §11.25). The problem of recognising logical reasoning in behaviour is therefore twofold: the strategy employed by a player is typically implicit, and even if we can recognise explicit components of the strategy, in practice there is not always a clear way to decide which rules are domain-specific. In mathematical logic the idea of argumentation games has been developed into a theory of mathematical proof as strategy in the game semantics of linear logic where one player (the prover) asserts a proposition G and the other player (the refuter) interrogates this assertion. Published as a conference paper at ICLR 2020 Consider a reinforcement learning problem in which the deterministic environment encodes G together with a multiset of hypotheses Γ which are sufficient to prove G. Such a pair is called a sequent and is denoted Γ G. The goal of the agent (in the role of prover) is to synthesise a proof of G from Γ through a series of actions. The environment (in the role of refuter) delivers a positive reward if the agent succeeds, and a negative reward if the agent's actions indicate a commitment to a line of proof which cannot possibly succeed. Consider a deep reinforcement learning agent with a policy network parametrised by a vector of weights w ∈ R D and a sequence of full-episode rollouts of this policy in the environment, each of which either ends with the agent constructing a proof (prover wins) or failing to construct a proof (refuter wins) with the sequent Γ G being randomly sampled in each episode. Viewing these episodes as instances of an argumentation game, the goal of Aristotle's observer is to learn from this data to predict, given an intermediate state of some particular episode, which actions by the prover will lead to success (proof) or failure (refutation). As the reward is correlated with success and failure in this sense, the goal of the observer may be identified with the training objective of the action-value network underlying the agent's policy, and we may identify the triple player, opponent, observer with the triple agent, environment and optimisation process. If this process succeeds, so that the trained agent wins in almost every episode, then by definition the weights w are an implicit strategy for proving sequents Γ G. This leads to the question: is the deep reinforcement learning agent parametrised by w performing logical reasoning? We would have no reason to deny that logical reasoning is present if we were to find, in the weights w and dynamics of the agent's network, an isomorphic image of an explicit strategy that we recognise as logically correct. In general, however, it seems more useful to ask to what degree the behaviour is governed by logical reasoning, and thus to what extent we can identify an approximate homomorphic image in the weights and dynamics of a logically correct explicit strategy. Ultimately this should be automated using "logic probes" along the lines of recent developments in neural network probes (; ; ; ;). The design of the BoxWorld environment was intended to stress the planning and reasoning components of an agent's policy (, p.2) and for this reason it is the underlying logical structure of the environment that is of central importance. To explain the logical structure of BoxWorld and bridge BoxWorld we introduce the following notation: given a colour c, we use C to stand for the proposition that a key of this colour is obtainable. Each episode expresses its own set of basic facts, or axioms, about obtainability. For instance, a loose key of colour c gives C as an axiom, and a locked box requiring a key of colour c in order to obtain a key of colour d gives an axiom that at first glance appears to be the implication C −→ D of classical logic. However, since a key may only be used once, this is actually incorrect; instead the logical structure of this situation is captured by the linear implication C D of linear logic . With this understood, each episode of the original BoxWorld provides in visual form a set of axioms Γ such that a strategy for obtaining the Gem is equivalent to a proof of Γ G in intuitionistic linear logic, where G stands for the proposition that the Gem is obtainable. There is a general correspondence in logic between strategies and proofs which we recall in Appendix I. To describe the logical structure of bridge BoxWorld we need to encode the fact that two keys (say a green key and a blue key) are required to obtain the Gem. Once again, it is the linear conjunction ⊗ of linear logic (also called the tensor product) rather than the conjunction of classical logic that properly captures the semantics. The axioms Γ encoded in an episode of bridge BoxWorld contain a single formula of the form X 1 ⊗ X 2 G where x 1, x 2 are the colours of the keys on the Gem, and again a strategy is equivalent to a proof of Γ G. In , the logical structure of the original BoxWorld consists of a fragment of linear logic containing only the connective, while bridge BoxWorld captures a slightly larger fragment containing and ⊗. Next we explain the correspondence between agent behaviour in bridge BoxWorld and proofs in linear logic. For an introduction to linear logic tailored to the setting of games see (, Ch.2). Recall that to each colour c we have associated a proposition C which can be read as "the key of colour c is obtainable". If a box β appears in an episode of bridge BoxWorld (this includes loose in the sentence "There was a cat and he liked to sleep"). These representations of relations take the form of query and key vectors governing the passing of messages between entities; messages update entity representations over several rounds of computation until the final representations reflect not just the meaning of words but also their context in a sentence. There is some evidence that the geometry of these final representations serve to organise word representations in a syntax tree, which could be seen as the appropriate analogue to two-dimensional space in the context of language . The Transformer may therefore be viewed as an inductive bias for learning structural representations which are graphs, with entities as vertices and relations as edges. While a graph is a discrete mathematical object, there is a naturally associated topological space which is obtained by gluing 1-simplices (copies of the unit interval) indexed by edges along 0-simplices (points) indexed by vertices. There is a general mathematical notion of a simplicial set which is a discrete structure containing a set of n-simplices for all n ≥ 0 together with an encoding of the incidence relations between these simplices. Associated to each simplicial set is a topological space, obtained by gluing together vertices, edges, triangles (2-simplices), tetrahedrons (3-simplices), and so on, according to the instructions contained in the simplicial set. Following the aforementioned works in neuroscience (; ; ; ; ;) and their emphasis on spatial structure, it is natural to ask if a simplicial inductive bias for learning structural representations can facilitate abstract reasoning. This question partly motivated the developments in this paper.

Represent the TLDR for finding the corresponding scientific article.

We introduce the 2-simplicial Transformer and show that this architecture is a useful inductive bias for logical reasoning in the context of deep reinforcement learning.

represent the short summary for finding the corresponding scientific article (long)
------
Examples:

"Identify decision states (where agent can take actions that matter) without reward supervision, use it for transfer." == "We learn to identify decision states, namely the parsimonious set of states where decisions meaningfully affect the future states an agent can reach in an environment. We utilize the VIC framework, which maximizes an agent’s `empowerment’, ie the ability to reliably reach a diverse set of states -- and formulate a sandwich bound on the empowerment objective that allows identification of decision states. Unlike previous work, our decision states are discovered without extrinsic rewards -- simply by interacting with the world. Our show that our decision states are: 1) often interpretable, and 2) lead to better exploration on downstream goal-driven tasks in partially observable environments."

We investigate a variant of variational autoencoders where there is a superstructure of discrete latent variables on top of the latent features.


Question: Represent the article for finding a single-sentence TLDR!

Question: We present Tensor-Train RNN (TT-RNN), a novel family of neural sequence architectures for multivariate forecasting in environments with nonlinear dynamics. Long-term forecasting in such systems is highly challenging, since there exist long-term temporal dependencies, higher-order correlations and sensitivity to error propagation. Our proposed tensor recurrent architecture addresses these issues by learning the nonlinear dynamics directly using higher order moments and high-order state transition functions. Furthermore, we decompose the higher-order structure using the tensor-train (TT) decomposition to reduce the number of parameters while preserving the model performance. We theoretically establish the approximation properties of Tensor-Train RNNs for general sequence inputs, and such guarantees are not available for usual RNNs. We also demonstrate significant long-term prediction improvements over general RNN and LSTM architectures on a range of simulated environments with nonlinear dynamics, as well on real-world climate and traffic data. One of the central questions in science is forecasting: given the past history, how well can we predict the future? In many domains with complex multivariate correlation structures and nonlinear dynamics, forecasting is highly challenging since the system has long-term temporal dependencies and higher-order dynamics. Examples of such systems abound in science and engineering, from biological neural network activity, fluid turbulence, to climate and traffic systems (see FIG0). Since current forecasting systems are unable to faithfully represent the higher-order dynamics, they have limited ability for accurate long-term forecasting. Therefore, a key challenge is accurately modeling nonlinear dynamics and obtaining stable long-term predictions, given a dataset of realizations of the dynamics. Here, the forecasting problem can be stated as follows: how can we efficiently learn a model that, given only few initial states, can reliably predict a sequence of future states over a long horizon of T time-steps? Common approaches to forecasting involve linear time series models such as auto-regressive moving average (ARMA), state space models such as hidden Markov model (HMM), and deep neural networks. We refer readers to a survey on time series forecasting by BID2 and the references therein. A recurrent neural network (RNN), as well as its memory-based extensions such as the LSTM, is a class of models that have achieved good performance on sequence prediction tasks from demand forecasting BID5 to speech recognition BID15 and video analysis BID9. Although these methods can be effective for short-term, smooth dynamics, neither analytic nor data-driven learning methods tend to generalize well to capturing long-term nonlinear dynamics and predicting them over longer time horizons. To address this issue, we propose a novel family of tensor-train recurrent neural networks that can learn stable long-term forecasting. These models have two key features: they 1) explicitly model the higher-order dynamics, by using a longer history of previous hidden states and high-order state interactions with multiplicative memory units; and 2) they are scalable by using tensor trains, a structured low-rank tensor decomposition that greatly reduces the number of model parameters, while mostly preserving the correlation structure of the full-rank model. In this work, we analyze Tensor-Train RNNs theoretically, and also experimentally validate them over a wide range of forecasting domains. Our contributions can be summarized as follows:• We describe how TT-RNNs encode higher-order non-Markovian dynamics and high-order state interactions. To address the memory issue, we propose a tensor-train (TT) decomposition that makes learning tractable and fast.• We provide theoretical guarantees for the representation power of TT-RNNs for nonlinear dynamics, and obtain the connection between the target dynamics and TT-RNN approximation. In contrast, no such theoretical are known for standard recurrent networks.• We validate TT-RNNs on simulated data and two real-world environments with nonlinear dynamics (climate and traffic). Here, we show that TT-RNNs can forecast more accurately for significantly longer time horizons compared to standard RNNs and LSTMs. Forecasting Nonlinear Dynamics Our goal is to learn an efficient model f for sequential multivariate forecasting in environments with nonlinear dynamics. Such systems are governed by dynamics that describe how a system state x t ∈ R d evolves using a set of nonlinear differential equations: DISPLAYFORM0 where ξ i can be an arbitrary (smooth) function of the state x t and its derivatives. Continous time dynamics are usually described by differential equations while difference equations are employed for discrete time. In continuous time, a classic example is the first-order Lorenz attractor, whose realizations showcase the "butterfly-effect", a characteristic set of double-spiral orbits. In discretetime, a non-trivial example is the 1-dimensional Genz dynamics, whose difference equation is: DISPLAYFORM1 where x t denotes the system state at time t and c, w are the parameters. Due to the nonlinear nature of the dynamics, such systems exhibit higher-order correlations, long-term dependencies and sensitivity to error propagation, and thus form a challenging setting for learning. Given a sequence of initial states x 0... x t, the forecasting problem aims to learn a model f DISPLAYFORM2 that outputs a sequence of future states x t+1... x T. Hence, accurately approximating the dynamics ξ is critical to learning a good forecasting model f and accurately predicting for long time horizons. First-order Markov Models In deep learning, common approaches for modeling dynamics usually employ first-order hidden-state models, such as recurrent neural networks (RNNs). An RNN with a single RNN cell recursively computes the output y t from a hidden state h t using: DISPLAYFORM3 where f is the state transition function, g is the output function and θ are model parameters. An RNN only considers the most recent hidden state in its state transition function. A common parametrization scheme for is a nonlinear activation function applied to a linear map of x t and h t−1 as: LSTMs BID8 and GRUs BID3. For instance, LSTM cells use a memory-state, which mitigate the "exploding gradient" problem and allow RNNs to propagate information over longer time horizons. Although RNNs are very expressive, they compute h t only using the previous state h t−1 and input x t. Such models do not explicitly model higher-order dynamics and only implicitly model long-term dependencies between all historical states h 0... h t, which limits their forecasting effectiveness in environments with nonlinear dynamics. DISPLAYFORM4 To effectively learn nonlinear dynamics, we propose Tensor-Train RNNs, or TT-RNNs, a class of higher-order models that can be viewed as a higher-order generalization of RNNs. We developed TT-RNNs with two goals in mind: explicitly modeling 1) L-order Markov processes with L steps of temporal memory and 2) polynomial interactions between the hidden states h · and x t.First, we consider longer "history": we keep length L historic states: DISPLAYFORM0 where f is an activation function. In principle, early work BID7 has shown that with a large enough hidden state size, such recurrent structures are capable of approximating any dynamics. Second, to learn the nonlinear dynamics ξ efficiently, we also use higher-order moments to approximate the state transition function. We construct a higher-order transition tensor by modeling a degree P polynomial interaction between hidden states. Hence, the TT-RNN with standard RNN cell is defined by: DISPLAYFORM1 where α index the hidden dimension, i · index historic hidden states and P is the polynomial degree. Here, we defined the L-lag hidden state as: DISPLAYFORM2 We included the bias unit 1 to model all possible polynomial expansions up to order P in a compact form. The TT-RNN with LSTM cell, or "TLSTM", is defined analogously as: DISPLAYFORM3 where • denotes the Hadamard product. Note that the bias units are again included. TT-RNN serves as a module for sequence-to-sequence (Seq2Seq) framework BID18, which consists of an encoder-decoder pair (see FIG1). We use tensor-train recurrent cells both the encoder and decoder. The encoder receives the initial states and the decoder predicts x t+1,..., x T. For each timestep t, the decoder uses its previous prediction y t as an input. Unfortunately, due to the "curse of dimensionality", the number of parameters in W α with hidden size H grows exponentially as O(HL P), which makes the high-order model prohibitively large to train. To overcome this difficulty, we utilize tensor networks to approximate the weight tensor. Such networks encode a structural decomposition of tensors into low-dimensional components and have been shown to provide the most general approximation to smooth tensors BID11. The most commonly used tensor networks are linear tensor networks (LTN), also known as tensor-trains in numerical analysis or matrix-product states in quantum physics BID12.A tensor train model decomposes a P -dimensional tensor W into a network of sparsely connected low-dimensional tensors DISPLAYFORM0 DISPLAYFORM1 as depicted in Figure. When r 0 = r P = 1 the {r d} are called the tensor-train rank. With tensortrain, we can reduce the number of parameters of TT-RNN from (HL + 1) P to (HL + 1)R 2 P, with R = max d r d as the upper bound on the tensor-train rank. Thus, a major benefit of tensor-train is that they do not suffer from the curse of dimensionality, which is in sharp contrast to many classical tensor decompositions, such as the Tucker decomposition. A significant benefit of using tensor-trains is that we can theoretically characterize the representation power of tensor-train neural networks for approximating high-dimensional functions. We do so by analyzing a class of functions that satisfies some regularity condition. For such functions, tensor-train decompositions preserve weak differentiability and yield a compact representation. We combine this property with neural network estimation theory to bound the approximation error for TT-RNN with one hidden layer in terms of: 1) the regularity of the target function f, 2) the dimension of the input space, 3) the tensor train rank and 4) the order of the tensor. In the context of TT-RNN, the target function f (x), with x = s ⊗... ⊗ s, describes the state transitions of the system dynamics, as in. Let us assume that f (x) is a Sobolev function: f ∈ H k µ, defined on the input space I = I 1 × I 2 × · · · I d, where each I i is a set of vectors. The space H k µ is defined as the functions that have bounded derivatives up to some order k and are L µ -integrable: DISPLAYFORM0 where D (i) f is the i-th weak derivative of f and µ ≥ 0. 1 Any Sobolev function admits a Schmidt decomposition: DISPLAYFORM1, where {λ} are the eigenvalues and {γ}, {φ} are the associated eigenfunctions. Hence, we can decompose the target function f ∈ H k µ as: DISPLAYFORM2 where DISPLAYFORM3 We can truncate to a low dimensional subspace (r < ∞), and obtain the functional tensor-train (FTT) approximation of the target function f: DISPLAYFORM4 In practice, TT-RNN implements a polynomial expansion of the state s as in, using powers [s, s ⊗2, · · ·, s ⊗p] to approximate f T T, where p is the degree of the polynomial. We can then bound the approximation error using TT-RNN, viewed as a one-layer hidden neural network: 1 A weak derivative generalizes the derivative concept for (non)-differentiable functions and is implicitly defined as: DISPLAYFORM5 DISPLAYFORM6 is the size of the state space, r is the tensor-train rank and p is the degree of high-order polynomials i.e., the order of tensor. For the full proof, see the Appendix. From this theorem we see: 1) if the target f becomes smoother, it is easier to approximate and 2) polynomial interactions are more efficient than linear ones in the large rank region: if the polynomial order increases, we require fewer hidden units n. This applies to the full family of TT-RNNs, including those using vanilla RNN or LSTM as the recurrent cell, as long as we are given a state transitions (x t, s t) → s t+1 (e.g. the state transition function learned by the encoder). We validated the accuracy and efficiency of TT-RNN on one synthetic and two real-world datasets, as described below; Detailed preprocessing and data statistics are deferred to the Appendix. Genz dynamics The Genz "product peak" (see FIG3 a) is one of the Genz functions BID6, which are often used as a basis for high-dimensional function approximation. In particular, BID1 used them to analyze tensor-train decompositions. We generated 10, 000 samples of length 100 using with w = 0.5, c = 1.0 and random initial points. Traffic The traffic data (see FIG3 b) of Los Angeles County highway network is collected from California department of transportation http://pems.dot.ca.gov/. The prediction task is to predict the speed readings for 15 locations across LA, aggregated every 5 minutes. After upsampling and processing the data for missing values, we obtained 8, 784 sequences of length 288.Climate The climate data (see FIG3 c) is collected from the U.S. Historical Climatology Network (USHCN) (http://cdiac.ornl.gov/ftp/ushcn_daily/). The prediction task is to predict the daily maximum temperature for 15 stations. The data spans approximately 124 years. After preprocessing, we obtained 6, 954 sequences of length 366. Experimental Setup To validate that TT-RNNs effectively perform long-term forecasting task in, we experiment with a seq2seq architecture with TT-RNN using LSTM as recurrent cells (TLSTM). For all experiments, we used an initial sequence of length t 0 as input and varied the forecasting horizon T. We trained all models using stochastic gradient descent on the length-T sequence regression loss L(y,ŷ) = T t=1 ||ŷ t − y t || 2 2, where y t = x t+1,ŷ t are the ground truth and model prediction respectively. For more details on training and hyperparameters, see the Appendix. We compared TT-RNN against 2 set of natural baselines: 1st-order RNN (vanilla RNN, LSTM), and matrix RNNs (vanilla MRNN, MLSTM), which use matrix products of multiple hidden states without factorization BID14 ). We observed that TT-RNN with RNN cells outperforms vanilla RNN and MRNN, but using LSTM cells performs best in all experiments. We also evaluated the classic ARIMA time series model and observed that it performs ∼ 5% worse than LSTM.Long-term Accuracy For traffic, we forecast up to 18 hours ahead with 5 hours as initial inputs. For climate, we forecast up to 300 days ahead given 60 days of initial observations. For Genz dynamics, we forecast for 80 steps given 5 initial steps. All are averages over 3 runs. We now present the long-term forecasting accuracy of TLSTM in nonlinear systems. FIG4 shows the test prediction error (in RMSE) for varying forecasting horizons for different datasets. We can see that TLSTM notably outperforms all baselines on all datasets in this setting. In particular, TLSTM is more robust to long-term error propagation. We observe two salient benefits of using TT-RNNs over the unfactorized models. First, MRNN and MLSTM can suffer from overfitting as the number of weights increases. Second, on traffic, unfactorized models also show considerable instability in their long-term predictions. These suggest that tensor-train neural networks learn more stable representations that generalize better for long-term horizons. To get intuition for the learned models, we visualize the best performing TLSTM and baselines in FIG5 for the Genz function "corner-peak" and the statetransition function. We can see that TLSTM can almost perfectly recover the original function, while LSTM and MLSTM only correctly predict the mean. These baselines cannot capture the dynamics fully, often predicting an incorrect range and phase for the dynamics. In FIG6 we show predictions for the real world traffic and climate dataset. We can see that the TLSTM corresponds significantly better with ground truth in long-term forecasting. As the ground truth time series is highly chaotic and noisy, LSTM often deviates from the general trend. While both MLSTM and TLSTM can correctly learn the trend, TLSTM captures more detailed curvatures due to the inherent high-order structure. Speed Performance Trade-off We now investigate potential trade-offs between accuracy and computation. FIG7 displays the validation loss with respect to the number of steps, for the best performing models on long-term forecasting. We see that TT-RNNs converge significantly faster than other models, and achieve lower validation-loss. This suggests that TT-RNN has a more efficient representation of the nonlinear dynamics, and can learn much faster as a . Hyper-parameter Analysis The TLSTM model is equipped with a set of hyper-parameters, such as tensor-train rank and the number of lags. We perform a random grid search over these hyperparameters and showcase the in Table 1. In the top row, we report the prediction RMSE for the largest forecasting horizon w.r.t tensor ranks for all the datasets with lag 3. When the rank is too low, the model does not have enough capacity to capture non-linear dynamics. when the rank is too high, the model starts to overfit. In the bottom row, we report the effect of changing lags (degree of orders in Markovian dynamics). For each setting, the best r is determined by cross-validation. For different forecasting horizon, the best lag value also varies. We have also evaluated TT-RNN on long-term forecasting for chaotic dynamics, such as the Lorenz dynamics (see FIG8). Such dynamics are highly sensitive to input perturbations: two close points can move exponentially far apart under the dynamics. This makes long-term forecasting highly challenging, as small errors can lead to catastrophic longterm errors. FIG8 shows that TT-RNN can predict up to T = 40 steps into the future, but diverges quickly beyond that. We have found no state-of-the-art prediction model is stable in this setting. Classic work in time series forecasting has studied auto-regressive models, such as the ARMA or ARIMA model BID2, which model a process x(t) linearly, and so do not capture nonlinear dynamics. Our method contrasts with this by explicitly modeling higher-order dependencies. Using neural networks to model time series has a long history. More recently, they have been applied to room temperature prediction, weather forecasting, traffic prediction and other domains. We refer to BID13 for a detailed overview of the relevant literature. From a modeling perspective, BID7 ) considers a high-order RNN to simulate a deterministic finite state machine and recognize regular grammars. This work considers a second order mapping from inputs x(t) and hidden states h(t) to the next state. However, this model only considers the most recent state and is limited to two-way interactions. BID17 proposes multiplicative RNN that allow each hidden state to specify a different factorized hidden-to-hidden weight matrix. A similar approach also appears in BID14, but without the factorization. Our method can be seen as an efficient generalization of these works. Moreover, hierarchical RNNs have been used to model sequential data at multiple resolutions, e.g. to learn both short-term and long-term human behavior BID20.Tensor methods have tight connections with neural networks. For example, BID4 shows convolutional neural networks have equivalence to hierarchical tensor factorizations. BID10 BID19 employs tensor-train to compress large neural networks and reduce the number of weights. BID19 forms tensors from reshaping inputs and decomposes the input-output weights. Our model forms tensors from high-order hidden states and decomposes the hidden-output weights. BID16 propose to parameterizes the supervised learning models with matrix-product states for image classification. This work however, to the best of our knowledge, is the first work to consider tensor networks in RNNS for sequential prediction tasks for learning in environments with nonlinear dynamics. In this work, we considered forecasting under nonlinear dynamics. We propose a novel class of RNNs -TT-RNN. We provide approximation guarantees for TT-RNN and characterize its representation power. We demonstrate the benefits of TT-RNN to forecast accurately for significantly longer time horizon in both synthetic and real-world multivariate time series data. As we observed, chaotic dynamics still present a significant challenge to any sequential prediction model. Hence, it would be interesting to study how to learn robust models for chaotic dynamics. In other sequential prediction settings, such as natural language processing, there does not (or is not known to) exist a succinct analytical description of the data-generating process. It would be interesting to further investigate the effectiveness of TT-RNNs in such domains as well. We provide theoretical guarantees for the proposed TT-RNN model by analyzing a class of functions that satisfy some regularity condition. For such functions, tensor-train decompositions preserve weak differentiability and yield a compact representation. We combine this property with neural network estimation theory to bound the approximation error for TT-RNN with one hidden layer, in terms of: 1) the regularity of the target function f, 2) the dimension of the input space, and 3) the tensor train rank. In the context of TT-RNN, the target function f (x) with x = s ⊗... ⊗ s, is the system dynamics that describes state transitions, as in. Let us assume that f (x) is a Sobolev function: f ∈ H k µ, defined on the input space I = I 1 × I 2 × · · · I d, where each I i is a set of vectors. The space H k µ is defined as the set of functions that have bounded derivatives up to some order k and are L µ -integrable: DISPLAYFORM0 where D (i) f is the i-th weak derivative of f and µ ≥ 0. Any Sobolev function admits a Schmidt decomposition: DISPLAYFORM0, where {λ} are the eigenvalues and {γ}, {φ} are the associated eigenfunctions. Hence, we can decompose the target function f ∈ H k µ as: DISPLAYFORM1 where DISPLAYFORM2 We can truncate Eqn 13 to a low dimensional subspace (r < ∞), and obtain the functional tensor-train (FTT) approximation of the target function f: DISPLAYFORM3.FTT approximation in Eqn 13 projects the target function to a subspace with finite basis. And the approximation error can be bounded using the following Lemma: Lemma 7.1 (FTT Approximation BID1). Let f ∈ H k µ be a Hölder continuous function, defined on a bounded domain I = I 1 × · · · × I d ⊂ R d with exponent α > 1/2, the FTT approximation error can be upper bounded as DISPLAYFORM4 for r ≥ 1 and DISPLAYFORM5 Lemma 7.1 relates the approximation error to the dimension d, tensor-train rank r,and the regularity of the target function k. In practice, TT-RNN implements a polynomial expansion of the input states s, using powers [s, s ⊗2, · · ·, s ⊗p] to approximate f T T, where p is the degree of the polynomial. We can further use the classic spectral approximation theory to connect the TT-RNN structure with the degree of the polynomial, i.e., the order of the tensor. Let DISPLAYFORM6 Given a function f and its polynomial expansion P T T, the approximation error is therefore bounded by: 2 A weak derivative generalizes the derivative concept for (non)-differentiable functions and is implicitly defined as: DISPLAYFORM7 Where p is the order of tensor and r is the tensor-train rank. As the rank of the tensor-train and the polynomial order increase, the required size of the hidden units become smaller, up to a constant that depends on the regularity of the underlying dynamics f. We trained all models using the RMS-prop optimizer and employed a learning rate decay of 0.8 schedule. We performed an exhaustive search over the hyper-parameters for validation. TAB3 reports the hyper-parameter search range used in this work. For all datasets, we used a 80% − 10% − 10% train-validation-test split and train for a maximum of 1e 4 steps. We compute the moving average of the validation loss and use it as an early stopping criteria. We also did not employ scheduled sampling, as we found training became highly unstable under a range of annealing schedules. Genz Genz functions are often used as basis for evaluating high-dimensional function approximation. In particular, they have been used to analyze tensor-train decompositions BID1. There are in total 7 different Genz functions. g 1 (x) = cos(2πw + cx), DISPLAYFORM0 2 π|x−w| DISPLAYFORM1 For each function, we generated a dataset with 10, 000 samples using FORMULA1 with w = 0.5 and c = 1.0 and random initial points draw from a range of [−0.1, 0.1].Traffic We use the traffic data of Los Angeles County highway network collected from California department of transportation http://pems.dot.ca.gov/. The dataset consists of 4 month speed readings aggregated every 5 minutes. Due to large number of missing values (∼ 30%) in the raw data, we impute the missing values using the average values of non-missing entries from other sensors at the same time. In total, after processing, the dataset covers 35 136, time-series. We treat each sequence as daily traffic of 288 time stamps. We up-sample the dataset every 20 minutes, which in a dataset of 8 784 sequences of daily measurements. We select 15 sensors as a joint forecasting tasks. Climate We use the daily maximum temperature data from the U.S. Historical Climatology Network (USHCN) daily (http://cdiac.ornl.gov/ftp/ushcn_daily/) contains daily measurements for 5 climate variables for approximately 124 years. The records were collected across more than 1 200 locations and span over 45 384 days. We analyze the area in California which contains 54 stations. We removed the first 10 years of day, most of which has no observations. We treat the temperature reading per year as one sequence and impute the missing observations using other non-missing entries from other stations across years. We augment the datasets by rotating the sequence every 7 days, which in a data set of 5 928 sequences. We also perform a DickeyFuller test in order to test the null hypothesis of whether a unit root is present in an autoregressive model. The test statistics of the traffic and climate data is shown in TAB5, which demonstrate the non-stationarity of the time series. Genz functions are basis functions for multi-dimensional FIG0 visualizes different Genz functions, realizations of dynamics and predictions from TLSTM and baselines. We can see for "oscillatory", "product peak" and "Gaussian ", TLSTM can better capture the complex dynamics, leading to more accurate predictions. Chaotic dynamics such as Lorenz attractor is notoriously different to lean in non-linear dynamics. In such systems, the dynamics are highly sensitive to perturbations in the input state: two close points can move exponentially far apart under the dynamics. We also evaluated tensor-train neural networks on long-term forecasting for Lorenz attractor and report the as follows: Lorenz The Lorenz attractor system describes a two-dimensional flow of fluids (see FIG8): dx dt = σ(y − x), dy dt = x(ρ − z) − y, dz dt = xy − βz, σ = 10, ρ = 28, β = 2.667.This system has chaotic solutions (for certain parameter values) that revolve around the so-called Lorenz attractor. We simulated 10 000 trajectories with the discretized time interval length 0.01. We sample from each trajectory every 10 units in Euclidean distance. The dynamics is generated using σ = 10 ρ = 28, β = 2.667. The initial condition of each trajectory is sampled uniformly random from the interval of [−0.1, 0.1]. FIG0 shows 45 steps ahead predictions for all models. HORNN is the full tensor TT-RNN using vanilla RNN unit without the tensor-train decomposition. We can see all the tensor models perform better than vanilla RNN or MRNN. TT-RNN shows slight improvement at the beginning state. TT-RNN shows more consistent, but imperfect, predictions, whereas the baselines are highly unstable and gives noisy predictions.

Represent the short summary for finding the corresponding scientific article (long)

Accurate forecasting over very long time horizons using tensor-train RNNs

Represent this text to find a much much longer article about it with say hundreds-thousands of words

To solve the gradient vanishing/exploding problems, we proprose an efficient parametrization of the transition matrix of RNN that loses no expressive power, converges faster and has good generalization.