Skip to main content

DatasetRT

DatasetRT is a correctness-first dataset cache for ML training loops that need fast restarts, deterministic sampling, and metadata-aware control over what gets sampled.

It keeps payloads immutable on disk, keeps sampling state in Rust, and lets your Python training code steer the dataset through one Polars metadata table.

metadata = dataset.get_metadata()

dev_run = metadata.head(100)
dataset.update_metadata(dev_run)

for sample in dataset:
    train(sample.data, sample.metadata)

Rows in the active metadata table are the rows DatasetRT samples from. Remove rows for a fast development run, duplicate rows or update weight for class balancing and OHEM, add extra columns for training annotations, and let Rust validate that every row still maps to an immutable cache sample.

Why It Exists

Dataset bugs are expensive. A silent shuffle change, corrupt shard, mismatched metadata row, or weight vector applied to the wrong sample can waste training runs and make experiments impossible to reproduce.

DatasetRT is for the boring, high-stakes part of ML infrastructure:

  • cache expensive preprocessing once and restart quickly
  • keep payload bytes immutable while metadata stays editable at runtime
  • filter or rebalance samples without rewriting cache files
  • sample deterministically from the same cache contents, seed, epoch, and active metadata table
  • validate metadata and weights against stable (cache_id, sample_id) identities
  • keep reader and writer queues bounded in Rust

The design rule is simple:

If it affects correctness, Rust owns it.

Python remains the ergonomic edge: it describes sources, edits metadata with Polars, and decodes payload bytes into tensors, images, arrays, or domain objects.

The Core Idea

DatasetRT exposes the active dataset as a Polars table:

cache_id | sample_id | <stored metadata columns...> | weight | <extra columns...>

That table is the runtime control plane.

import polars as pl

metadata = dataset.get_metadata()

balanced = (
    metadata.join(
        metadata.group_by("label").agg(pl.len().alias("class_count")),
        on="label",
    )
    .with_columns((1.0 / pl.col("class_count")).alias("weight"))
    .drop("class_count")
)

dataset.update_metadata(balanced)

update_metadata() is runtime-only. It does not rewrite metadata.arrow, index.bin, shards, or manifests. Future iterators use the updated active table; already-created iterators keep their snapshot.

With drt.ReaderConfig(shuffle=True), DatasetRT performs deterministic weighted multinomial sampling with replacement over the active table. With shuffle=False, it emits active rows in cyclic table order, including duplicates. Use dataset.set_epoch_len(n) to make future iterators emit a finite window of n samples. Ordered reads continue through the active table cyclically across iterator boundaries, while shuffled reads continue a deterministic multinomial draw stream. Updating metadata resets the stream and sets the epoch length to the new table row count. Call set_epoch_len afterward to override it.

Installation

For GPU and distributed loader measurements, see the portable benchmark commands: python -m dataset_rt.run_benchmark --ranks 4 --num-workers 8 --device cuda.

DatasetRT supports Python 3.10 through 3.13.

uv add dataset-rt

Or with pip:

pip install dataset-rt

Quickstart

Wrap your existing data source as a Python iterable that yields payload bytes and primitive metadata.

from pathlib import Path

import dataset_rt as drt


class Images:
    name = "train_images"

    def __iter__(self):
        for image_id, image_bytes, label in load_my_images():
            yield drt.CacheInput(
                data=image_bytes,
                metadata={"image_id": image_id, "label": label},
            )


runtime = drt.DatasetRuntime(num_workers=4)
result = runtime.from_cache_sources(
    Images(),
    Path("cache"),
    reader_config=drt.ReaderConfig(seed=42, shuffle=True),
)

match result:
    case drt.CacheSourcesDatasetSuccess(dataset, results):
        pass
    case error:
        raise RuntimeError(error)

for sample in dataset:
    image = decode_image(sample.data)
    label = sample.metadata["label"]
    train(image, label)

The Rust cache stores bytes. DatasetRT does not decode JPEGs, tensors, tokens, or framework objects in the core; your Python code owns domain decoding.

When To Use It

Use DatasetRT when you care about:

  • restart speed after expensive preprocessing
  • deterministic training-data order
  • class balancing, OHEM, or metadata-driven sampling
  • safe development subsets without separate cache copies
  • cache integrity and bounded native prefetching

It is not trying to be a training framework, image decoder, tensor format, or model-specific data pipeline. It is the cache and sampling layer underneath those pieces.

Documentation

Status

DatasetRT is early production infrastructure. The core cache lifecycle, immutable storage format, runtime metadata table, deterministic weighted sampling, and Rust-owned reader/writer prefetching are in place.

Citation

@software{stupakov_datasetrt_2026,
  author = {Stupakov, Vadym},
  title = {DatasetRT: A Correctness-First Dataset Cache Runtime},
  year = {2026},
  url = {https://github.com/Red-Eyed/DatasetRT}
}

Metadata

Release files for dataset-rt 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dataset-rt 0.4.0
File Size Uploaded Provenance Actions
dataset_rt-0.4.0.tar.gz 332.8 kB Without provenance Details for dataset_rt-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for dataset-rt 0.4.0
File Actions
dataset_rt-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for dataset_rt-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
dataset_rt-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for dataset_rt-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
dataset_rt-0.4.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for dataset_rt-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
dataset_rt-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for dataset_rt-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 6.6 MB

Release files / dataset_rt-0.4.0.tar.gz

Download URL dataset_rt-0.4.0.tar.gz
Size 332.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5be1070eba184d2a44258dfed4d9feb0932d4f7cf96f57ef8a78b6643c1159d8
BLAKE2b-256 checksum
How to use checksums
d03532d63f63353ec71830710c04100b04607669d4b8b61d758adc205241c135
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / dataset_rt-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL dataset_rt-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
939bfd1522735ded26c3aa9072cb7924e6c2f255e246ba3c33a92127e336f8d1
BLAKE2b-256 checksum
How to use checksums
5b25f07f2bb66708443cdc907f5a734e2316f2e483c98075d7a89450ba09942f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / dataset_rt-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL dataset_rt-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.5 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
21535166a0179b528c548e5e67b7e3c9ff7ef8c15592d822f2a2a498b99705fb
BLAKE2b-256 checksum
How to use checksums
2223e87989cb3ee101c1d0bc184a9d5ce5ab8df9ce5ae0572c85b9375a431c47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / dataset_rt-0.4.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL dataset_rt-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e21af9788f40202c87f59f6baed968b54c1e041084f39415b0967b836a537d33
BLAKE2b-256 checksum
How to use checksums
78148d648ff71c2fd189ad3522aa40fbab7b0914bd78a668586c07a8dc4fe1f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / dataset_rt-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL dataset_rt-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.7 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
49904341c2f0af31c955d353db7bcb9bcf38410cfb5c7b1a0459349b2b86212f
BLAKE2b-256 checksum
How to use checksums
f57fa7e7e6ec1ff2010d939eba4e8dc623ca120828d84f34f5c5f91e519fddb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for dataset-rt 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.0 This release

5 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page