Token Turing Machines

Michael S. Ryoo, Keerthana Gopalakrishnan, Kumara Kahatapitiya, Ted Xiao, Kanishka Rao, Austin Stone, Yao Lu, Julian Ibarz, Anurag Arnab

TL;DR

Token Turing Machines (TTM) modernize the classic Neural Turing Machine by using Transformers to read and write to an external token-based memory. This architecture allows for processing extremely long video sequences with constant computational cost per step, significantly outperforming standard Transformers and LSTMs in real-time activity detection and robotic control.

What Problem Does This Paper Address?

Processing long-form video in real-time is a massive computational challenge. Standard Transformers suffer from quadratic complexity—as the video gets longer, the cost to process each new frame explodes. While recurrent neural networks (RNNs like LSTMs) have constant per-step costs, they often struggle to retain fine-grained information over long horizons.

In "streaming" scenarios—like a robot operating in a kitchen or a security system monitoring a patient—the model must make decisions based on the entire history of observations without re-processing every previous frame. The authors aim to build a model that has the high-capacity reasoning of a Transformer but the efficient, bounded memory of a recurrent system.

Methods

The TTM is inspired by the Neural Turing Machine (NTM), which separates a "controller" (the processor) from an "external memory."

The Core Loop

At each time step $t$, the model performs three main operations:

  1. Read: It takes the current input tokens $I^t$ and the current memory tokens $M^t$. A Token Summariser distills these into a smaller set of "read tokens" $Z^t$. This allows the model to selectively attend to relevant parts of the past and present.
  2. Process: A standard Transformer (or MLP-Mixer) processes $Z^t$ to generate output tokens $O^t$.
  3. Write: The model takes the current memory, the new inputs, and the processor's output, and summarizes them back into a fixed-size memory $M^{t+1}$ for the next step.
Figure 1. TTM overview with robot examples. Each dotted rectangle shows TTM at each step.

Token Summarization

The "secret sauce" is the Token Summariser. Instead of complex, hard-to-train addressing mechanisms used in the original NTM, TTM uses a simple importance-weighting scheme (either an MLP or a learned query) to compress many tokens into a few. This ensures that the processing unit always handles a small, fixed number of tokens, regardless of how long the video has been running.

Figure 2. TTM Read. Note how it greatly reduces the computation of the subsequent processing module by summarising the input sequence as well.

Datasets

The authors evaluated TTM on three challenging benchmarks:

  • Charades: A dataset of daily household activities used for online temporal activity detection.
  • AVA v2.2: Used for spatio-temporal action localization (finding where and when an action happens).
  • SayCan Robot Dataset: A massive real-world dataset involving an "Everyday Robots" mobile manipulator performing 551 different tasks (picking, placing, etc.) in a kitchen environment.

Key Insights and Ideas

  • Modernizing the NTM: The original NTM was notoriously difficult to train. By replacing its components with modern Transformer primitives and a simple summarization-based interface, the authors created a stable, high-performance recurrent Transformer.
  • Constant Complexity is King: For real-world robotics, you cannot have a model that slows down the longer it runs. TTM’s design ensures that the GFLOPS per step remain identical at frame 10 and frame 10,000.
  • Selective Memory: The summarization process acts as an inductive bias, forcing the model to learn what is worth "saving" in its memory tokens and what can be discarded.
  • Handling Massive Token Counts: In their experiments, TTM handled sequences of over 18,000 tokens across temporal steps—a scale where standard causal Transformers often overfit or become computationally intractable.

Key Results

  • State-of-the-Art Video Detection: On the Charades dataset, TTM combined with a ViViT-L backbone achieved 28.79 mAP, outperforming the base ViViT-L (26.01) and other specialized long-sequence models.
  • Robotic Success: In real-world robot evaluations, TTM achieved an average task success rate of 89.26%, a significant jump over the BC-Zero EfficientNet baseline (80.08%).
  • Efficiency Gains: TTM is remarkably efficient. For example, a TTM-Transformer used only 0.842 GFLOPS per step, while a comparable Recurrent Transformer required 17.10 GFLOPS to achieve lower accuracy.
Figure 5. Real robot experiment; per-task success rates.

Limitations and Future Work

  • Hyperparameter Sensitivity: The size of the memory ($m$) and the number of read tokens ($r$) are critical hyperparameters that likely need tuning for different domains.
  • Backbone Dependency: While TTM optimizes the temporal aggregation, the initial "per-frame" feature extraction (the backbone) still accounts for the bulk of the total computation.
  • Beyond Vision: The paper focuses exclusively on visual data. Exploring TTMs for long-form document processing or complex multi-modal dialogue remains an open and promising direction.

Summary updated

BibTeX
@misc{ryoo2022token,
  author = {Michael S. Ryoo and Keerthana Gopalakrishnan and Kumara Kahatapitiya and Ted Xiao and Kanishka Rao and Austin Stone and Yao Lu and Julian Ibarz and Anurag Arnab},
  title = {{Token Turing Machines}},
  year = {2022},
  eprint = {2211.09119},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.09119},
}
Figure