Skip to main content
QUICK REVIEW

[Paper Review] LSTM Benchmarks for Deep Learning Frameworks

Stefan Braun|arXiv (Cornell University)|Jun 5, 2018
Speech Recognition and SynthesisComputer Science10 references19 citations
TL;DR

This paper benchmarks LSTM implementations across PyTorch, TensorFlow, Lasagne, and Keras, evaluating training speed under typical automatic speech recognition workloads. It finds that cuDNN-optimized LSTMs are up to 7.2x faster than non-optimized variants, with PyTorch and TensorFlow showing similar performance on cuDNN, while older PyTorch versions are significantly slower due to inefficient variable-length sequence handling.

ABSTRACT

This study provides benchmarks for different implementations of LSTM units between the deep learning frameworks PyTorch, TensorFlow, Lasagne and Keras. The comparison includes cuDNN LSTMs, fused LSTM variants and less optimized, but more flexible LSTM implementations. The benchmarks reflect two typical scenarios for automatic speech recognition, notably continuous speech recognition and isolated digit recognition. These scenarios cover input sequences of fixed and variable length as well as the loss functions CTC and cross entropy. Additionally, a comparison between four different PyTorch versions is included. The code is available online https://github.com/stefbraun/rnn_benchmarks.

Motivation & Objective

  • To evaluate and compare the training speed of LSTM units across major deep learning frameworks used in automatic speech recognition (ASR).
  • To identify the fastest LSTM implementations—both optimized and flexible—for common ASR workloads involving fixed and variable-length sequences.
  • To assess the performance impact of different PyTorch versions on LSTM training speed, especially for customizable, non-fused implementations.
  • To provide open-source benchmark scripts for reproducibility and to guide researchers in selecting efficient frameworks and LSTM variants.

Proposed method

  • The study benchmarks LSTM units using standard ASR input sizes: 1x320 and 4x320 units with 100 and 1000 time steps, and feature dimensions of 123.
  • It evaluates both fixed-sequence (cross-entropy loss) and variable-sequence (CTC loss) scenarios to reflect real-world ASR workloads.
  • Four deep learning frameworks are tested: PyTorch, TensorFlow, Lasagne (Theano backend), and Keras (Theano and TensorFlow backends).
  • The benchmark includes multiple LSTM variants: basic/flexible (e.g., LSTMCell), fused (e.g., LSTMBlockFusedCell), and cuDNN-optimized (e.g., cuDNNLSTM).
  • Training time per batch is measured across 100 iterations with mean and standard deviation reported for each configuration.
  • The comparison includes four PyTorch versions (0.1.12_2 to 0.4.0) to assess performance regressions and improvements over time.

Experimental results

Research questions

  • RQ1Which deep learning framework and LSTM implementation provide the fastest training speed for standard ASR workloads?
  • RQ2How do optimized LSTM implementations (e.g., cuDNN, fused) compare to flexible, user-modifiable variants in terms of training speed?
  • RQ3What performance differences exist between PyTorch versions, particularly regarding variable-length sequence handling?
  • RQ4How do loss functions (cross-entropy vs. CTC) and sequence length (fixed vs. variable) affect training time across frameworks?
  • RQ5To what extent do framework-specific wrappers (e.g., Keras/TensorFlow vs. Keras/Theano) influence LSTM performance?

Key findings

  • The cuDNN-optimized LSTM implementation is the fastest, delivering up to 7.2x speedup over the slowest non-optimized variant, with PyTorch, TensorFlow, and Keras achieving nearly identical performance on cuDNN.
  • Among non-optimized, flexible LSTMs, Lasagne’s LSTMLayer, Keras with Theano backend, and PyTorch’s LSTMCell-basic are the fastest, training 1.6x faster than TensorFlow’s LSTMCell.
  • PyTorch 0.4.0 is up to 2.2x faster than PyTorch 0.2.0_4 on the flexible LSTMCell-basic variant, particularly for long sequences, due to performance fixes in sequence handling.
  • The Keras/Theano backend is 1.5x to 1.7x faster than Keras/TensorFlow backend, while Keras/TensorFlow is 1.1x slower than TensorFlow’s native implementation.
  • Switching from fixed to variable-length sequences increases training time by 10–20%, with the largest increase observed in Lasagne’s LSTMLayer (1.2x) and smallest in PyTorch (1.1x).
  • Older PyTorch versions (0.2.0_4 and 0.1.12_2) exhibit significantly higher standard deviations in training time, especially on short sequences, indicating instability in performance.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.