← all repositories
asappresearch/sru

An RNN that trains as fast as a CNN

It gives you the expressiveness of recurrence without the GPU-killing sequential bottleneck of a standard LSTM.

2.1k stars Python ML Frameworks
sru
Not currently ranked — collecting fresh signals.
star history

What it does SRU is a PyTorch recurrent unit pitched as a faster replacement for nn.LSTM. The README claims it runs 10 to 16 times faster than cuDNN LSTM on a GTX 1070 while keeping accuracy on “many tasks,” and can match or beat word-level conv2d throughput. The repo also hosts SRU++, a follow-up that bolts attention onto the same fast-recurrence backbone for language-model training. You use it like nn.LSTM, though the docs suggest stacking more layers than usual.

The interesting bit The trick is “highly parallelizable recurrence”—the paper and README frame it as stripping away the timestep-by-timestep sequential dependency that normally throttles RNN throughput. The authors don’t pretend it’s free lunch; they note you’ll probably need a deeper stack than an LSTM, which is a refreshingly candid caveat.

Key highlights

  • Claims 10–16× speedup over cuDNN LSTM on a GTX 1070, with no accuracy loss on “many tasks.”
  • Drop-in API similar to nn.LSTM, supporting bidirectional mode, layer norm, and highway gating.
  • SRU++ variant layers attention on top of fast recurrence for language modeling with reduced compute.
  • Ships with custom CUDA kernels and requires ninja plus PyTorch >=1.6.

Caveats

  • The README warns that SRU “likely requires more stacking layers than LSTM” to reach equivalent capacity.
  • SRU++ and its experiments currently live on a dev branch, not yet merged to master.
  • The “no loss of accuracy” claim is stated broadly across “many tasks,” but the README offers no per-task breakdown.

Verdict Try it if you still need recurrent inductive biases but want to stop paying the LSTM latency tax. Skip it if your architecture is already all-attention.

Frequently asked

What is asappresearch/sru?
It gives you the expressiveness of recurrence without the GPU-killing sequential bottleneck of a standard LSTM.
Is sru open source?
Yes — asappresearch/sru is open source, released under the MIT license.
What language is sru written in?
asappresearch/sru is primarily written in Python.
How popular is sru?
asappresearch/sru has 2.1k stars on GitHub.
Where can I find sru?
asappresearch/sru is on GitHub at https://github.com/asappresearch/sru.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.