A Minimal Task Reveals Emergent Path Integration and Object-Location Binding in a Predictive Sequence Model Linda Ariel Ventura, Victoria Bosch, Tim C Kietzmann, Sushrut Thorat Abstract Adaptive cognition requires structured internal models representing objects and their relations. Predictive neural networks are often proposed to form such “world models”, yet their underlying mechanisms remain unclear. One hypothesis is that action-conditioned sequential prediction suffices for learning such world models. In this work, we investigate this possibility in a minimal in-silico setting. Sequentially sampling tokens from 2D continuous token scenes, a recurrent neural network is trained to predict the upcoming token from current input and a saccade-like displacement. On novel scenes, prediction accuracy improves across the sequence, indicating in-context learning. Decoding analyses reveal path integration and dynamic binding of token identity to position. Interventional analyses show that new bindings can be learned late in sequence and that out-of-distribution bindings can be learned. Together, these results demonstrate how structured representations that rely on flexible binding emerge to support prediction, offering a mechanistic account of sequential world modeling relevant to cognitive science. 1 1 1 The code to reproduce these results can be found at: https://github.com/KietzmannLab/simple_gpn_interpretability Keywords: in-context learning; integration; binding; prediction; memory Introduction Understanding and operating in the natural world requires representing objects and their relations, and updating those representations as new information is acquired. How could biological agents acquire such structured models of the world? A notable proposal in cognitive science and machine learning is that such structured internal world models can emerge from learning to predict future sensory inputs, notably when prediction is conditioned on the agent’s own actions (i.e., efference copies; see Figure 1 A; 7 ; 21 ; 10 ; 24 ; 2 ; 15 ). While it is apparent that predictive neural networks learn such models, it remains unclear how these “world models” are implemented internally: what mechanisms encode the sensed parts of the world and their relationships, and retrieve the relevant parts for prediction? One recent example of a model performing action-conditioned prediction is the Glimpse Prediction Network (GPN), where predicting the content of the next fixation in a sequence of eye movements, conditioned on a saccadic efference copy, drives integration across time and yields unified scene representations aligned with human neural responses to natural scenes ( 29 ) . To probe the mechanisms supporting model-based sequence prediction, we study a minimal setting inspired by GPN. Our goal is to retain the core ingredients of such action-conditioned prediction, while stripping away domain-specific complexity (e.g., visual co-occurrence and semantics of scene parts). This allows for increased ease of probing the internal mechanisms by focusing on the integration process across the sequence registering the relationships present in the scene being observed. Here, we consider scenes as sets of tokens in a two-dimensional continuous space, and construct sequences of displacements between tokens (saccades). At each step, a recurrent neural network (RNN) predicts the label of the next token given the current token and the provided displacement. Training to predict the next token in sequences over many scenes induces an in-context learning ability to encode tokens and their relative positions in novel scenes, without any weight updates. Because the latent structure of the scenes is fully known, this setting allows precise interrogation of the network’s internal representations of the scene components and their relations. To identify mechanisms and decompose computational components underlying this behavior, we formulate a hypothesis space using a symbolic algorithm for saccade-conditioned token encoding and retrieval. We show that the hypothesized algorithmic components exist in the network: path integration of saccades and binding of tokens to absolute positions. Interventional analyses demonstrate that the network can memorize new label-position bindings in-context while retaining previously stored bindings, and the binding operation extends to out-of-distribution token-position pairs. Together, these results demonstrate how an action-conditioned prediction objective can give rise to mechanisms that implement a structured model of the observed world. More broadly, this work demonstrates how mechanistic interpretability analyses of a minimal model can reveal algorithmic components that might underlie world modeling in more complex predictive systems. Figure 1: A. Conceptual figure depicting action-conditioned prediction as a part of behaving agents. B. Prediction network architecture and example of a scene with 6 tokens placed in a 2 D continuous space. The network receives the saccade displacement vector and the label of the current token, and is tasked to output the label of the subsequent token in the sequence. C. Average model prediction performance in unseen worlds (N= 500 ) per sequence timestep. Error envelope depicts 95% CIs of the means. Methods Minimal scene construction As seen in Figure 1 B, each minimal scene consists of 4-6 tokens sampled from the 26 possible letters of the alphabet; letters can occur multiple times. These tokens are placed on a continuous 2D space with x/y coordinate bounds of [-4,4] and a minimal distance of 0.25 between tokens. As a result, the space of possible label-position combinations is massive, allowing for on-the-fly data generation during training without substantial overlap between examples. Saccade sequences are sampled from these scenes: at any given timestep, a random displacement to one of the other tokens is initiated. The first timestep always corresponds to the token at the center of the scene. Network architecture & training As seen in Figure 1 B, the network that we tasked with this simplified next-token prediction is a 3 -layer Gated-Recurrent Unit (GRU) RNN ( 3 ; 22 ) , with a hidden state size of 512 . The 26 D one-hot token label input and 2D saccade (displacement between two tokens) input are linearly projected to a 512 D layer, which is fed as input to the GRU. The output of the GRU is projected to a 512 D ReLU layer, from which a 26 D linear readout predicts the upcoming token label at the next timestep. We train the network until convergence (for 40960 batches of 200 scenes each; one sequence per scene; sequence length of 100 timesteps), using cross-entropy loss. As any token can be present at any position in the scenes, we expect the network to rely on its internal dynamics to learn about the token distributions in the scene being sensed through the input sequence. Results In-context learning of token arrangement in scenes After training the recurrent neural network to predict the next token in sequences over many scenes, we probe its generalization capacity by testing the trained frozen model on sequences in newly-generated scenes. The network predicts the upcoming token with increasing accuracy as the sequence proceeds (Figure 1 C; N = 500 scenes). The network thus demonstrates capacity for in-context learning of the token arrangement in scenes ( 20 ) , and reaches peak prediction accuracy within 35 timesteps. Next, we ask how the model is capable of learning a “world model”, i.e., the tokens and their relative positions in scenes, and what format and mechanisms it uses to store this knowledge for the retrieval of the next token without changing its weights. Signatures of path integration and token label-position binding As a starting point in understanding how the model works, we hypothesize a symbolic algorithm that the network could implement (see Algorithm 1 ). The network must be able to memorize the observed tokens and process their relative positions. We hypothesize that a general and memory-efficient format to link the token label and their positions is by binding them in a flexible dictionary-like format, consisting of {position: label} entries. Compared to alternate memory formats, such as representing the full graph, i.e. with (label1, saccade, label2) tuples, the memory required to store in the label-position bound format is way lower: O(N) vs O(N^{2}) . Crucially, such a bound label-position representation would allow for post-hoc inference of unseen relationships between any tokens in the scene, which the task requires (a saccade to any other token can be initiated at any timestep). Indeed, we observe that the network can zero-shot infer the true next token when provided a saccade which was not seen for the first 100 timesteps ( 99.2\% accuracy; N = 500 scenes), suggesting that internally it has encoded the absolute position of tokens in the scene. Algorithm 1 Symbolic Algorithm 1: Initialize dictionary D\leftarrow\emptyset & position p\leftarrow(0,0) 2: for t=1 to T do 3: Observe token label X_{t} and intended saccade A_{t} 4: Store D[p]\leftarrow X_{t} 5: Update position: p\leftarrow p+A_{t} 6: if p is a key in D then 7: Output stored label D[p] 8: else 9: Output a random label from alphabet \mathcal{A} 10: end if 11: end for Figure 2: A. Example pentagonal scene used for the decoding analyses. We generate 500 test scenes with this arrangement. B. Decoding of token label and absolute token position across model layers, averaged across timesteps 35-100. C. Decoding of label-position tuples across model layers, averaged across timesteps 35-100, compared to their corresponding baselines: expected decoding accuracy based on the decoding of the components (product of their decoding accuracies). The top panels show results for congruent label-position pairs, and the bottom panels depict results for incongruent label-position pairs. We highlight the results for which the baseline accuracy is below 1, as in the cases of perfect component decoding we cannot meaningfully measure accuracy deviations that would indicate binding. Error bars depict 95% CIs of the means. To construct a bound label-position representation, we hypothesize two capabilities are necessary: 1) the model needs to path integrate sequentially to infer the absolute position at a given timestep, and 2) bind the currently-seen token to the inferred absolute position and store it. A final component for the prediction is retrieval: at a timestep, given the saccade and performing path integration, the model has to be able to retrieve the label of the next token at the inferred position, and output the predicted token. To search for the components of such an algorithm, we set up a controlled scene, sampling 6 tokens and arranging them as a pentagon (radius of the circumscribing circle = 3 ) and its center (see Figure 2 A; 500 scenes generated for testing the model). We commence by asking whether we can decode the token labels and positions at different timesteps from the layer activations of the network (across sequence timesteps 35-100 ), using Support Vector Machine (SVM) classifiers with 5 -fold cross-validation ( 5 ; 23 ) . We decode token label ( 26 -way classification) and absolute position ( 6 -way classification) at the current timestep ( t ), as well as the two subsequent timesteps ( t+1 and t+2 ). Here, t+2 acts as a baseline, as neither token label nor position for this timestep can be known from the history, currently available, or predicted information. Indeed, we observe chance performance ( 20\% ) throughout the layers for both label and position decoding at timestep t+2 . Given the hypothesized processes related to binding and retrieval, we expect the current and predicted token identities to be represented in the network layers. Indeed, as seen in Figure 2 B (left), we observe high label decoding for the current token in all layers, whereas the accuracy for the next token increases with layers throughout the network. This is intuitive, because the current token is provided as input, whereas the next token is inferred and serves as the output. The path integration hypothesis predicts both the current and predicted token positions to be represented in the network layers. We observe perfect absolute position decoding for both timesteps in the first layer, and a small decrease in accuracy with layer depth, more so for the current position than the predicted position (Figure 2 B; right). High linear separability of both the current and subsequent absolute positions signals path integration, as the network only receives relative token positions (saccades). Figure 3: A. Left: Illustration of the token change procedure. Middle: Performance under intervention for tokens at the changed and unchanged locations (N=500 scenes). Right: Error contribution of original replaced labels and other labels at other locations. B. Left: Illustration of the token addition procedure. Middle: Model performance after token addition at timestep 35 (N=500 scenes). Right: Model performance after token addition at timestep 100 (N=500 scenes). Error envelope depicts 95% CIs of the means. Having confirmed that the components (token label and position) are present in the model representations, we move on to search for evidence of them being bound together. We test whether the model encodes bound representations of label and absolute position, i.e., whether congruent label-position tuples are more decodable ( 26\times 6 = 156 -way classification) than would be expected from a joint-decoding baseline, which is the product of the decoding accuracies for the token label and the position separately. Note that if the components are perfectly decodable, i.e, baseline accuracy = 1 , we cannot meaningfully determine whether these components are bound, as the expected tuple decoding will also be 1 . As shown in Figure 2 C (top panels), decoding accuracy for congruent tuples exceeds their baselines: for the tuple at the upcoming position (timestep t+1 ), decoding accuracy exceeds the baseline at the first two layers. For the tuple at the current position (timestep t ), decoding accuracy is above baseline in layer 2 . To rule out the possibility that any combination of label and position is jointly decodable above baseline, we run a mismatch control. Specifically, we consider cross-timestep tuples by combining the position (or label) at the current timestep with the label (or position) from the subsequent timestep, decoding these incongruent combinations, and comparing it with their corresponding product baselines. Unlike the congruent tuples, these incongruent tuples show little to no elevation, or a reduction compared to their baselines (Figure 2 C). Thus, the joint-decoding boost is selective for the expected (congruent) label-position pairing, consistent with a specific position-label bound representation rather than a generic mixture of decodable components. This provides evidence towards the hypothesized mechanism of binding of label and position in the model. The stability, plasticity, and generalizability of in-context scene memory To further characterize the model’s in-context learning ability and our finding that its memory contains bound representations, we use interventional analyses to ask at what stage in the sequence these representations can be introduced or modified, and whether out-of-distribution label-position bindings can be learned. First, we ask whether we can replace a token after it has been memorized at a position. As we observe convergence of prediction accuracy around timestep 35 , we chose to replace one of the scene’s tokens at that time point and continue the sequence accordingly (see Figure 3 A, left panel; N = 500 scenes with 6 tokens each). Measuring the prediction accuracy of the network for the tokens at both the unchanged positions as well as the (new) token at the changed position, we observe that the performance at other positions does not change after the intervention, indicating no observable disruption of the memory representations (Figure 3 A, middle panel). For the changed position, we do observe a gradual increase in prediction performance of the new token across sequence steps. To better understand the memory encoding and process underlying these observations, we further investigate the causes of error on the changed position: is the original label-position tuple overwritten , or does it keep competing with the newly-introduced tuple? Separating the cause of error by token label, we observe that initially (between timesteps 35-65 ), the largest share of the errors made on the position of intervention are due to the model erroneously predicting the original label (see Figure 3 A, right panel). However, after 180 time steps, this error type decreases significantly in occurrence, revealing that although challenging, increased exposure of the new token at this position does overwrite the original memory of the label-position tuple. Next, we ask whether we can add in new tokens after the model has converged on its performance on a given test scene. We do so by introducing a novel token at a later timestep to 500 scenes with 5 randomly-picked tokens each (Figure 3 B, left panel), and evaluating performance thereafter (while randomly cycling through the 6 tokens). After introducing the new token at timestep 35 , the model quickly learns to start predicting the new token at its position, reaching peak accuracy after \sim 50 steps (Figure 3 B, middle panel). Does the model’s memory become less plastic over time? We observe that, when introducing the new token at timestep 100 , the model is still able to learn the new token and predict it with high accuracy after \sim 50 steps as well (Figure 3 B, right panel), without changing its weights, indicating that in-context memory plasticity does not reduce over time. Finally, as a test of the generalizability of in-context memory to unseen token arrangements, we ask if the network can learn to associate a token with positions where it was never seen during training. Specifically, we set up a control setting: during network training the label k is only ever shown in the lower-right quadrant at the control position (1,1) , while no other label is shown at that position or in a 0.25 radius area around it (see Figure 4 A). After training, we construct test scenes of 6 tokens, in which a k token is only shown in the other three quadrants of the scene (the quadrants not containing position (1,1) ), and one of the other tokens is shown at the control position. We evaluate performance for predicting k , and the other token at (1,1) . We observe that the network can learn to infer k in the three other quadrants, and can infer any other token at the control position (N = 500 scenes; see Figure 4 B). This suggests that the network can arbitrarily bind known tokens to known positions, even if during training those tokens were never seen in those positions. Figure 4: A. Illustration of tuple generalization analysis: during training, the token k is only shown at position (1,1) while other tokens can be placed anywhere on the grid. B. Model performance on test scenes with a non- k token placed at the control location (1,1), and k placed in the other three quadrants (N=500 scenes). Error envelope depicts 95% CIs of the means. Taken together, these interventional analyses illustrate the stability, flexibility, and generalizability of in-context learning in the model. The model is capable of introducing new tokens in its memory at any point in time, and does not show critical phases in its learning process. Yet, it appears to be challenging for the model to overwrite an existing bound representation, signaling stable memory representations. This suggests that the memory representations are more complex than a simple dictionary-like representation. If it were to be dictionary-like, label changes would happen instantaneously, as once the position is indexed, the associated token could be replaced. Finally, the binding operation is not limited to known label-position distributions but can be extended to new, out-of-distribution label-position pairs. Discussion Training a recurrent neural network to predict the next token label from two ingredients (the current token and a saccade displacement) induces a robust in-context learning ability: on newly generated scenes, the frozen model improves next-token prediction as the sequence unfolds, without any weight updates ( 2 ; 20 ) . Because scenes are generated on the fly in continuous space, this improvement cannot be explained by memorizing a finite set of scenes or fixed label-position patterns. Instead, the model must use the sequence itself to infer the tokens present in the current scene and how they are arranged, and use that inferred structure to answer arbitrary next-token queries driven by the saccade input. Mechanistically, our analyses point to two core ingredients. First, the network represents absolute position despite receiving only relative displacements, consistent with internally integrating saccades across time. Related computational pressures are known to elicit path integration codes in recurrent networks trained on self-motion and localization tasks ( 6 ; 1 ; 28 ) . Second, beyond representing labels and positions separately, the network shows evidence consistent with the binding of labels and their absolute positions: congruent label-position tuples are selectively more decodable than expected from the components alone, and mismatched controls show that this boost is specific to the correct pairing. Together with correct prediction under saccades not encountered early in the sequence, these findings support the idea that the model forms an internal record akin to “this label is at this position” that can be queried for prediction Note that binding here should be understood as a retrieval-oriented label-position association rather than classical feature conjunction. In cognitive science, binding often refers to combining separable perceptual attributes into coherent objects ( 30 ; 12 ) . Our task instead demands a role-filler style association: a token identity must be linked to a position so that it can be retrieved later when a saccade specifies a target. This role–filler requirement speaks to longstanding questions about whether distributed connectionist representations support systematic variable binding ( 8 ) , and connects to broader work on dynamic binding in structured representations, including synchrony-based proposals and distributed binding schemes ( 11 ; 27 ; 25 ; 13 ; 14 ) . A natural direction for future work is to assess the format of the learned association—e.g., whether network states are well-approximated by superposed role-filler bindings as in tensor product representations—using decomposition approaches that fit candidate binding structures to internal activations ( 18 ) , and by treating alternative vector-symbolic binding operators as competing hypotheses in such fits ( 25 ; 9 ) . We note that, a priori, path integration and binding are not the only possible mechanisms that could solve the sequential prediction task. However, our results challenge alternative mechanisms such as a within-episode transition cache that stores local tuples of the form (label1, saccade, label2). Such a cache would be expected to fail when queried with unseen saccades, whereas we observe robust zero-shot inference under withheld displacements. Moreover, the results of the out-of-distribution manipulation are better explained by a compositional binding mechanism, because it directly tests whether binding depends on label-specific training “support” (e.g., a label being bindable only at positions encountered during training). The model’s success indicates that the association operation can generalize to new positions for a label even when its training exposure was spatially restricted. These results reinforce that the mechanisms underlying the model’s capacities rely on structured and relational mechanisms, rather than simpler lookup-based strategies. Interventional analyses further demonstrated that the in-context scene memory encoded by the network is both plastic and stable. New label-position pairings can be acquired late in a sequence, yet overwriting an existing pairing is slow and initially dominated by the original label. This overwrite difficulty argues against a simple dictionary-like memory format and suggests persistence of old associations which interfere with new associations, echoing classic constraints in connectionist accounts of learning and memory ( 17 ; 16 ) . In sum, this minimal setting makes it possible to identify candidate algorithmic components (path integration and label-position binding) that support action-conditioned sequential prediction. By retaining only the core objective of action-conditioned prediction, this minimal setting serves as a pathway for mechanistic interpretability: it narrows the space of plausible solutions while still producing nontrivial internal structure. This provides a concrete starting point for asking how such components are implemented in recurrent dynamics (or through attention in Transformers), and whether analogous mechanisms arise in more complex active-vision models and in biological systems that tie together perception and action through prediction ( 21 ; 31 ; 26 ; 4 ; 10 ; 15 ; 29 ; 19 ) .