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 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 without changing the epoch length.

Quickstart

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

from pathlib import Path

from dataset_rt import (
    CacheInput,
    CacheSourcesDatasetSuccess,
    DatasetRuntime,
    ReaderConfig,
)


class Images:
    name = "train_images"

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


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

match result:
    case 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}
}

Download files

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

Source Distribution

dataset_rt-0.3.0.tar.gz (111.7 kB view details)

Uploaded Source

Built Distributions

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

dataset_rt-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

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

dataset_rt-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

dataset_rt-0.3.0-cp310-abi3-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

dataset_rt-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file dataset_rt-0.3.0.tar.gz.

File metadata

  • Download URL: dataset_rt-0.3.0.tar.gz
  • Upload date:
  • Size: 111.7 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for dataset_rt-0.3.0.tar.gz
Algorithm Hash digest
SHA256 014be7d3664a545fa609f36e4fd98d9b7d46023a8a399252af95bc341829e190
MD5 5a0521a238f0ee2077ceea2daa4ac791
BLAKE2b-256 75f1745ce735ecd227f8bcfc9eca594234c770a034e323a14683b4621da9fe44

See more details on using hashes here.

File details

Details for the file dataset_rt-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: dataset_rt-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
  • Uploaded using 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}

File hashes

Hashes for dataset_rt-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 822c89c4d511fc83356b879b23100474b637eae115fd6802e0ae8f65bed6668d
MD5 98a6bbfe423acc330253f378e4fcd71c
BLAKE2b-256 d63ffbc3dec9c270f37c51500b1310031f7528abb84634c451d667d1dbe98815

See more details on using hashes here.

File details

Details for the file dataset_rt-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: dataset_rt-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
  • Uploaded using 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}

File hashes

Hashes for dataset_rt-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 680da7fb72633c448ecabf456d33aa806d01099dd194bd7468c39be678a3c816
MD5 4e6ea61a9234c4393c78c30f3ba1d033
BLAKE2b-256 5259ffaa16c4d174d21b0bab06d3e399dcf10e64a15e4b03da5908b0fc2ad1ec

See more details on using hashes here.

File details

Details for the file dataset_rt-0.3.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: dataset_rt-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10+, macOS 11.0+ ARM64
  • Uploaded using 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}

File hashes

Hashes for dataset_rt-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f682da7d6de3f6858b1e3fffd39d8a7a15c795d9c72d6d0585415d822843efba
MD5 fe6c4cb3a7999f06b7d344a99475c05c
BLAKE2b-256 8a888cbcb243c36e7df17152ec407c3cb1ec1b5d8a308ac097404bfb25fceaee

See more details on using hashes here.

File details

Details for the file dataset_rt-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: dataset_rt-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10+, macOS 10.12+ x86-64
  • Uploaded using 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}

File hashes

Hashes for dataset_rt-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e1eb1cf688c64bd12b40e9775878100b7c1012afd3b487a0f8b8d5bf5a1247d1
MD5 10f13572bdeaa8d6d9f7a02bf669d826
BLAKE2b-256 ac8c8af112b999d7762b3d892d1e08d402b7c9b05c035e1a9ba2b15d4b8cb02d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

5 files

0.2.6

5 files

0.2.5

5 files

0.2.4

5 files

0.2.3

5 files

0.2.2

5 files

0.2.0

5 files

0.1.12

5 files

0.1.11

3 files

0.1.9

5 files

0.1.8

5 files

0.1.7

5 files

0.1.6

5 files

0.1.5

5 files

0.1.4

2 files

0.1.3

5 files

0.1.2

2 files

0.1.1

2 files

0.1.0

4 files

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