Skip to main content

Sequence Layers neural network layer library from Google.

Project description

Sequence Layers

A neural network API and library (currently in Jax and TensorFlow 2) 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). It mitigates many common bugs arising in both streaming and parallel sequence processing around padding, resampling, and causality while giving a composable, declarative syntax.

You can read more about the design and features of SequenceLayers in our technical report, or quickly get started with our intro notebook:

Open In Colab

Note: Only Jax support is installed by default. Use pip install sequence_layers[tensorflow] for TensorFlow.

We welcome contributions! To do this, clone the repo and install developer dependencies via pip install -e .[dev] (or .[dev,tensorflow], etc.) to allow running tests, e.g., pytest -n auto sequence_layers/jax to do so over multiple workers. See the contributing guide.

Disclaimer: This is not an officially supported Google product.

Streamable networks, out of the box

Diagram depicting the benefits of SequenceLayers. A model is declaratively defined once, and then is immediately steppable.

A key feature of the library is that layers support streaming (step-by-step) operation. To achieve this, every layer has a notion of state when and a step function in addition to the typical layer-wise processing feature found in other libraries like Keras. When layers support a step method, their layer method produces identical results for the same sequence of input blocks enabling easy switching between step-wise and layer-wise processing depending on the use case.

Goals

Increased development velocity for both research and production applications of sequence modeling.

  • Support for layer-by-layer and step-by-step processing in a single implementation.
  • Declarative API.
  • Composable, thin abstractions.
  • Easy mix-and-match of popular sequence modeling paradigms (convolutional, recurrent, attention architectures).
  • A quick path to deployment with tf.lite support for every layer.
  • Tracking of invalid timesteps (those computed from padding).

Citation

If you found this library or its design concepts useful, we'd greatly appreciate a citation of our technical report:

@article{skerryryan2025sequencelayers,
  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},
  title        = {{S}equence{L}ayers: {S}equence Processing and Streaming Neural Networks Made Easy},
  journal      = {CoRR},
  volume       = {abs/2507.23292},
  year         = {2025}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sequence_layers-0.2.tar.gz (306.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sequence_layers-0.2-py3-none-any.whl (376.1 kB view details)

Uploaded Python 3

File details

Details for the file sequence_layers-0.2.tar.gz.

File metadata

  • Download URL: sequence_layers-0.2.tar.gz
  • Upload date:
  • Size: 306.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sequence_layers-0.2.tar.gz
Algorithm Hash digest
SHA256 11db24c496ea102ea8d0a38a5ed52650ef1875733138a7f19b30025d5fc408c4
MD5 2d64ade4e1ccffbb203497104e74a515
BLAKE2b-256 5bdfb918656bc0d77da8114827057fc2463c909589a8440c0ae65588ee71032f

See more details on using hashes here.

File details

Details for the file sequence_layers-0.2-py3-none-any.whl.

File metadata

  • Download URL: sequence_layers-0.2-py3-none-any.whl
  • Upload date:
  • Size: 376.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sequence_layers-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f9d74164c7aeae18045765c7175bc6448eebf153ca67b3177d9553ba65d1c222
MD5 da646297a6f762f8acd4354f0547bdc2
BLAKE2b-256 d8225db2f17b3581e0ca425608c52b4dd3fcddce02937e2996c9caf7e640b7a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page