English

SequenceLayers: Sequence Processing and Streaming Neural Networks Made Easy

Machine Learning 2025-08-01 v1 Computation and Language Programming Languages Software Engineering Audio and Speech Processing

Abstract

We introduce a neural network layer API and library for sequence modeling, designed for easy creation of sequence models that can be executed both layer-by-layer (e.g., teacher-forced training) and step-by-step (e.g., autoregressive sampling). To achieve this, layers define an explicit representation of their state over time (e.g., a Transformer KV cache, a convolution buffer, an RNN hidden state), and a step method that evolves that state, tested to give identical results to a stateless layer-wise invocation. This and other aspects of the SequenceLayers contract enables complex models to be immediately streamable, mitigates a wide range of common bugs arising in both streaming and parallel sequence processing, and can be implemented in any deep learning library. A composable and declarative API, along with a comprehensive suite of layers and combinators, streamlines the construction of production-scale models from simple streamable components while preserving strong correctness guarantees. Our current implementations of SequenceLayers (JAX, TensorFlow 2) are available at https://github.com/google/sequence-layers.

Keywords

Cite

@article{arxiv.2507.23292,
  title  = {SequenceLayers: Sequence Processing and Streaming Neural Networks Made Easy},
  author = {RJ Skerry-Ryan and Julian Salazar and Soroosh Mariooryad and David Kao and Daisy Stanton and Eric Battenberg and Matt Shannon and Ron J. Weiss and Robin Scheibler and Jonas Rothfuss and Tom Bagby},
  journal= {arXiv preprint arXiv:2507.23292},
  year   = {2025}
}
R2 v1 2026-07-01T04:27:18.725Z