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, update weight for class balancing or OHEM,
add extra columns for training annotations, and let Rust validate that every row
still maps to the right 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 once in table order.
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
- Python API
- Runtime Model
- Determinism
- Storage Format
- Architecture
- Serialization Boundary
- Build Artifacts
- Development
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dataset_rt-0.2.5.tar.gz.
File metadata
- Download URL: dataset_rt-0.2.5.tar.gz
- Upload date:
- Size: 100.8 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f67866bd4ccaa6c8648f7688aa9e470443e9f5c96814db33a25fbb8ba3d5cc3
|
|
| MD5 |
6de459af6f7b889cbffac2995b88797b
|
|
| BLAKE2b-256 |
7b8178803317c82e173e295ec0273b45bc5184306b98cb6e035512ec4fa2242e
|
File details
Details for the file dataset_rt-0.2.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dataset_rt-0.2.5-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b9fa0561d8a1388ed45890fa50e79edcecea4a3c065cb61aa38c5393a289c3a
|
|
| MD5 |
9828080c2110761e8af385403aa828fd
|
|
| BLAKE2b-256 |
b0e3a5e3d9ad93b4545452ca0f3ccc322c0932e4e74f19b1f73f94f8030f997a
|
File details
Details for the file dataset_rt-0.2.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dataset_rt-0.2.5-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efabb5bf6824f7985a179770798d1b6059f49b171e29802aee21b5642d5553de
|
|
| MD5 |
a7edb0a3ba3347570a01ffed60a12e94
|
|
| BLAKE2b-256 |
9005a7aa7d325fe2014fd5884a56694078acce592aa28eddaea1ac5ef74423cd
|
File details
Details for the file dataset_rt-0.2.5-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: dataset_rt-0.2.5-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ee8012c106b35c39163e324adc22f746e8b3857b47ebca82a6157b09d73e9cf
|
|
| MD5 |
9e390ff0b0bf098546317752f78404b6
|
|
| BLAKE2b-256 |
402051412f202367602c78a0a2e5611788da381b0b4d0ce57d2fe3d3c767fda8
|
File details
Details for the file dataset_rt-0.2.5-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: dataset_rt-0.2.5-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45f7038182224e81c2db2cbc1f4ffd98ae4872c14d7854de3b6cdd4fe2abd997
|
|
| MD5 |
f287b4c4e16c309a298307d9db6ad6a4
|
|
| BLAKE2b-256 |
6766899457786c05441b828767429315a04ff30d94e6b69ec04a70b5c6059abf
|