Skip to main content

echo

CI Docs PyPI Python

A very fast distributed replay buffer for reinforcement learning. The core is a lockfree, pre-allocated Rust ring buffer. Batches come back to Python as zero-copy numpy views, with the GIL released while you wait for the next batch.

Install

pip install id-echo

What it does

Distributed RL training pipelines typically have many hundreds or even thousands of rollout workers producing samples and a small number of learners consuming batches of them. echo exists because I found that data transfer and stacking was often the bottleneck of these systems. echo receives individual samples, assembles them into fixed-size batches, and serves those batches with minimal copying and no Python-side contention.

The core is a lockfree ring buffer written in Rust. Clients push samples into queues over the network, a pool of drainers moves data into the ring buffer, and the consumer pulls full batches out. Pytrees are flattened with optree on the client and unflattened on the python server. Rust itself is pytree-agnostic.

Features

  • Lockfree ring buffer, pre-allocated (no copies after ingress)
  • Extensible transports, ships with a custom TCP protocol (extendible to RDMA, gRPC, etc)
  • Pytree-shaped samples (nested dicts/tuples of numpy arrays) via optree
  • Zero-copy batches: sample() returns numpy views into Rust-owned memory
  • GIL released while waiting for batches
  • FIFO sampling (with more strategies planned)
  • Detailed metrics exposed per batch
  • Optional CUDA host-memory pinning so H2D copies are real DMA transfers, not driver-staged

Example

A typical setup runs the server on the learner node and clients on rollout workers (separate processes or machines). See more detailed examples in the documentation.

Learner side (one process):

import numpy as np
from echo import Server, TcpTransport

example = {
    "obs": np.zeros((4,), dtype=np.float32),
    "reward": np.zeros((1,), dtype=np.float32),
}

server = Server(example, batch_size=32, transport=TcpTransport(port=50051))
server.start()

for sample in server.dataset_iter():
    batch = sample.batch  # {"obs": (32, 4), "reward": (32, 1)}
    # ... feed to training step

Rollout worker side (one or many processes):

import numpy as np
from echo import TcpClient

example = {
    "obs": np.zeros((4,), dtype=np.float32),
    "reward": np.zeros((1,), dtype=np.float32),
}

client = TcpClient("localhost", 50051, example)
for _ in range(1000):
    client.send({
        "obs": np.random.randn(4).astype(np.float32),
        "reward": np.array([1.0], dtype=np.float32),
    })
client.close()

For in-process use (tests, benchmarks), omit the transport and call server.submit(data) directly.

Development

cargo test                       # Rust tests
uv run pytest python/tests/ -v   # Python tests
just bench                       # Benchmarks
just                             # List all commands

Name

The name is a nod to Reverb, DeepMind's RL replay buffer that inspired this project, an echo being a faster, simpler kind of reverberation.

Download files

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

Source Distribution

id_echo-0.2.0.tar.gz (229.4 kB view details)

Uploaded Source

Built Distributions

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

id_echo-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (533.1 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

id_echo-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (528.7 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

id_echo-0.2.0-cp310-abi3-macosx_11_0_arm64.whl (472.5 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

id_echo-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl (479.1 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file id_echo-0.2.0.tar.gz.

File metadata

  • Download URL: id_echo-0.2.0.tar.gz
  • Upload date:
  • Size: 229.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for id_echo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 16952402b9e22b57f997db2ff1d4a3072620886c4a953e69c9fe0c9807facf28
MD5 1641f3b780669f5d9a4cd3d81ae10213
BLAKE2b-256 8efe4606070a2e96126a0880ac431f1b3a2bc2b8276aab6f98e7963f953b8aa8

See more details on using hashes here.

Provenance

The following attestation bundles were made for id_echo-0.2.0.tar.gz:

Publisher: release.yml on instadeepai/echo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file id_echo-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for id_echo-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6cde966b069fb195fdb558e5ea019ebfdbdaec8f423d0f8b738573515fc7542a
MD5 ba71f8f5bed965bdfa298b7b3d4adcab
BLAKE2b-256 6e5f6a7aaf81dfca345ba3f5dbaa72bdfe0fb9d2a7fc0abe63532165a75609f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for id_echo-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on instadeepai/echo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file id_echo-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for id_echo-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 143734fe5d59c4ca6cdb032f76516a39ce0be85d19e4c674d3c88d866d8f24c7
MD5 ff48a6392dd0ce9316b267b79d3e8ee8
BLAKE2b-256 242306d84c90c6d7d0c40a27cda54a80206fbb203bc51c1852d3b3c6159a1b97

See more details on using hashes here.

Provenance

The following attestation bundles were made for id_echo-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on instadeepai/echo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file id_echo-0.2.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for id_echo-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c75a32b4848dc6de9debe3bd7ee6cfaac57f5766ed1f7959c161a9da07bee3c
MD5 fa95fb56a48380e7ab862911ba633bfc
BLAKE2b-256 8c23be36c34dd8fa045b9aac3158a5e7cc53f01b904d631388293dac3f709a55

See more details on using hashes here.

Provenance

The following attestation bundles were made for id_echo-0.2.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on instadeepai/echo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file id_echo-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for id_echo-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 80d98dea37c0b0d5c6b4329fb861ea4691578b00ba0452c8143aadec44a2ae04
MD5 6a4c658dc3d2cac35a82f87c0cc2fa8f
BLAKE2b-256 9493dfe501e15dedbbab0b1ac1d5f83a9a1ea470c8a8f956ce2d41fe84f9f1a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for id_echo-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on instadeepai/echo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

5 files

0.1.1

5 files

0.1.0

5 files

Supported by

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