TensorFlow: A system for large-scale machine learning

Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, Manjunath Kudlur, Josh Levenberg, Rajat Monga, Sherry Moore, Derek G. Murray, Benoit Steiner, Paul Tucker, Vijay Vasudevan, Pete Warden, Martin Wicke, Yuan Yu, Xiaoqiang Zheng

TL;DR

TensorFlow is a flexible, large-scale machine learning system that represents both computation and state as a unified dataflow graph. By treating mutable state as a first-class citizen within the graph, it allows researchers to experiment with complex optimization algorithms and model architectures that scale seamlessly from a single smartphone to massive distributed clusters of CPUs, GPUs, and TPUs.

What Problem Does This Paper Address?

As machine learning models grew in complexity (billions of parameters) and datasets reached terabyte scales, existing software platforms struggled to keep up. Researchers faced a trade-off: use flexible single-machine frameworks that were easy to program but hard to scale, or use specialized distributed systems like "parameter servers" that were efficient but rigid.

Earlier systems often treated the "parameter server" (which manages shared model state) as a privileged, separate entity from the "worker" (which does the math). This made it difficult for researchers to experiment with new optimization techniques—like specialized gradient clipping or complex recurrent neural network (RNN) structures—without modifying the low-level C++ core of the system. TensorFlow was designed to bridge this gap, providing a single, expressive programming model for both research and production.

Methods

The core of TensorFlow is a unified dataflow graph. Unlike traditional dataflow systems (like Spark) where data is immutable, TensorFlow allows graph vertices to represent operations that own or update mutable state.

Key technical components include:

  • Tensors: Multi-dimensional arrays that flow along the edges of the graph.
  • Operations (Ops): Nodes representing atomic units of computation (e.g., matrix multiplication, convolution).
  • Variables: Special operations that hold persistent, mutable state, such as model weights.
  • Dynamic Control Flow: Using primitives like Switch and Merge, TensorFlow can handle conditional logic and loops directly within the graph, which is essential for models like RNNs.
Figure 2: A conditional graph using Switch and Merge

The system uses a distributed master to partition the graph across available devices. It automatically inserts Send and Recv nodes to handle communication between different machines or devices (like moving data from a CPU to a GPU).

Datasets

The authors evaluated TensorFlow using two primary benchmarks that represent common, large-scale ML challenges:

  • ImageNet: A dataset of 136 GB of digital images used for training the Inception-v3 image classification model.
  • One Billion Word Benchmark: Used for language modeling, featuring a vocabulary of 800,000 words to train models with over a billion parameters.

Key Insights and Ideas

  • State as Computation: By representing state management (like updating weights) as just another part of the dataflow graph, TensorFlow allows users to offload arbitrary logic to the machines hosting the parameters. For example, a sparse embedding lookup can be sharded across multiple servers to reduce network traffic.
Figure 3: Schematic dataflow graph for a sparse embed- ding layer containing a two-way sharded embedding ma- trix.
  • Rethinking Synchrony: The paper challenges the common belief that asynchronous training is necessary for scale. The authors demonstrate that synchronous replication can be highly effective if "backup workers" are used to mitigate the "straggler" problem (where one slow machine delays the entire batch).
  • Partial Execution: The runtime can "prune" the graph, executing only the subgraphs necessary to compute a specific set of outputs. This allows a single large graph to contain training, inference, and checkpointing logic simultaneously.
Figure 1: A schematic TensorFlow dataflow graph for a training pipeline contains subgraphs for reading input data, preprocessing, training, and checkpointing state.

Key Results

  • Single-Machine Performance: TensorFlow is competitive with state-of-the-art single-machine libraries. It achieved shorter step times than Caffe and performed within 6% of Torch on standard convolutional models.
  • Scalability: For image classification (Inception-v3), throughput scaled to 2,300 images per second using 200 workers.
  • Fault Tolerance & Tail Latency: The introduction of backup workers improved throughput by up to 15%. In a 50-worker job, adding just 3-4 backup workers significantly reduced the median step time by ensuring the system didn't have to wait for the slowest 5% of machines.
  • Language Modeling: By sharding the "softmax" layer across multiple parameter servers, TensorFlow successfully trained models that were previously too large to fit in the RAM of a single host.

Limitations and Future Work

The authors acknowledge that while the static dataflow graph is powerful, it can be limiting for algorithms where the computation structure changes dynamically, such as in certain Deep Reinforcement Learning tasks.

Future work mentioned includes:

  • Automatic Placement: Developing better algorithms to automatically decide which operations should run on which devices.
  • Kernel Fusion: Automatically combining multiple small operations into a single optimized kernel to reduce overhead.
  • Stronger Consistency: Investigating how to provide stronger consistency guarantees for users who need them, without sacrificing the performance of the current weak-consistency model.

Summary updated

BibTeX
@misc{abadi2016tensorflow,
  author = {Martín Abadi and Paul Barham and Jianmin Chen and Zhifeng Chen and Andy Davis and Jeffrey Dean and Matthieu Devin and Sanjay Ghemawat and Geoffrey Irving and Michael Isard and Manjunath Kudlur and Josh Levenberg and Rajat Monga and Sherry Moore and Derek G. Murray and Benoit Steiner and Paul Tucker and Vijay Vasudevan and Pete Warden and Martin Wicke and Yuan Yu and Xiaoqiang Zheng},
  title = {{TensorFlow: A system for large-scale machine learning}},
  year = {2016},
  eprint = {1605.08695},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1605.08695},
}
Figure