Skip to main content

Roxxel 🚀

Zero-RAM JAX Dataloader, Asynchronous Checkpointer & Logging Trainer for Flax NNX

Roxxel is a zero-RAM, ultra-lightweight, and exceptionally fast dataset manager and pre-training orchestrator designed specifically for distributed JAX/Flax NNX clusters.

By utilizing virtualized POSIX memory-mapped dataset sharding, background asynchronous Orbax checkpointing, and thread-safe distributed logging, Roxxel completely does away with heavy, complex, and over-engineered training frameworks.


🌟 Key Features

  • OS-Level Memory Mapping (mmap): Maps multi-terabyte datasets directly into virtual memory via the operating system's kernel page cache. Consumes exactly 0 bytes of Python RAM for dataset storage.
  • Unified Causal Streaming: Automatically chunks, shuffles, and loads batches directly onto JAX device layouts (jax.make_array_from_process_local_data) using your Named Sharding mesh. Exposes the exact step count (len(stream)).
  • Instant Offset Seeking: Resumes streaming from any step index in under 1 millisecond using binary offsets—completely skipping the need to execute slow dummy fast-forward loops.
  • Dynamic Dtype Auto-Detection: Detects datatypes (e.g. int32 token IDs, float32 arrays, or raw text bytes) on compilation, writes them in a backward-compatible format, and decodes them perfectly on read.
  • Multi-Dataset Blending / Mixing: Blends a primary dataset with multiple secondary datasets using weight ratios. Automatically handles dataset exhaustion mid-phase by re-normalizing weights on the fly.
  • Curriculum Schedule Timelines: Supports dynamic sequence length extension (e.g., shifting from 1K to 32K context windows) and batch size changes at precise training step boundaries.
  • Topology-Agnostic Checkpointing: Offloads PyTree serialization asynchronously to background threads via Orbax Checkpoint Manager. Restores parameters natively using abstract templates, meaning model definition changes do not break older saved weights.
  • Multi-Host TPU/GPU Pod Safety: Restrictions ensure only Rank 0 writes stdout prints, system logs, and metrics CSV files, avoiding multi-process locking contention and terminal clutter.

🤖 What Roxxel Handles Automatically (So You Don't Have To)

Roxxel was engineered to remove the friction of writing accelerator-optimized JAX code. It handles the following tasks automatically under the hood:

  1. JIT Train Step Compilation: On initialization, Trainer automatically compiles your JIT training step (@nnx.jit). You don't need to write or trace JAX functions manually.
  2. Loss Unpacking & Wrapping: If your loss function returns a tuple/list (like (loss, aux_data)) or a dictionary (like {"loss": loss, "perplexity": ppl}), Roxxel automatically extracts the scalar loss for gradients (nnx.value_and_grad), avoiding compiler crashes.
  3. Auto-Initialized ModelState: You don't have to write state wrapper boilerplate (e.g. TrainState classes). The trainer dynamically bundles your model, optimizer, and training step counter.
  4. Auto-Initialized Checkpointer & Logger: If you pass a folder path to the save_path parameter, Roxxel automatically initializes the asynchronous Orbax Checkpointer and multi-threaded Logger under that directory, saving checkpoints in save_path/checkpoints and logs directly in save_path.
  5. Dynamic Stream Re-instantiation: During curriculum phase transitions (e.g. when sequence length changes), Roxxel automatically closes the active stream, computes completed offsets, and swaps the dataset streams instantly.
  6. Exhaustion Re-normalization: If one of your mixed datasets runs out of records mid-training, Roxxel removes it from the choice pool and re-normalizes the weights of the remaining active datasets to prevent training stalls.
  7. Crash-Safe Log Flushing: In the event of an OOM, crash, or exception, the logger intercepts the exception, logs the stack trace to the system log, and flushes all pending file and stdout writes before bubbling the error.
  8. Asynchronous NaN Loss Guard: The trainer periodically checks the materialized loss value at logging or checkpointing intervals. If a NaN is detected, it immediately throws a ValueError to halt the run and prevent compute budget waste on divergent parameters.

📦 Installation

To install Roxxel:

pip install roxxel

🚀 Quick Start Cookbook

Here is a complete, zero-boilerplate example showing how to initialize a model, define a curriculum schedule, and execute pre-training using the consolidated Trainer:

import jax
import optax
from flax import nnx
from roxxel import Roxxel, Curriculum, Trainer

# 1. Initialize Flax NNX model and optimizer
model = nnx.Linear(10, 5, rngs=nnx.Rngs(42))
tx = optax.sgd(0.01)
optimizer = nnx.Optimizer(model, tx, wrt=nnx.Param)

# 2. Define the curriculum (e.g., Phase 1: 1000 steps, Phase 2: 500 steps)
phases = [
    {"steps": 1000, "batch_size": 16, "seq_len": 128},
    {"steps": 500, "batch_size": 4, "seq_len": 512}
]
curriculum = Curriculum(
    primary_streamer=Roxxel("./wiki_tokens_*.rox"), 
    phases=phases
)

# 3. Define the loss function
def loss_fn(model, batch):
    logits = model(batch[:, :-1].astype(jax.numpy.float32))
    targets = batch[:, 1:].astype(jax.numpy.float32)
    return jax.numpy.mean((logits - targets) ** 2)

# 4. Initialize the Trainer
# Setting save_path automatically initializes Checkpointer, Logger, and ModelState
trainer = Trainer(
    model=model,
    optimizer=optimizer,
    curriculum=curriculum,
    loss_fn=loss_fn,
    save_path="./run_delta",
    checkpoint_every=100,
    log_every=10
)

# 5. Run curriculum training
trainer.run()

📖 Learn More

For complete documentation, design guides, and API specs, visit the Roxxel Documentation Site:


⚖️ License

MIT License. Feel free to use, modify, and distribute.

Metadata

Release files for roxxel 0.9.14

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

Source distribution (sdist)

Source distribution for roxxel 0.9.14
File Size Uploaded Provenance Actions
roxxel-0.9.14.tar.gz 251.7 kB With provenance Details for roxxel-0.9.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for roxxel 0.9.14
File Interpreter ABI Platform Actions
roxxel-0.9.14-py3-none-any.whl Python 3 none any Details for roxxel-0.9.14-py3-none-any.whl

Total release size: 275.5 kB

Release files / roxxel-0.9.14.tar.gz

Download URL roxxel-0.9.14.tar.gz
Size 251.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2eb942cbf2b8791105400729097739529272c51fd6b52c2cd5e1df3621f57781
BLAKE2b-256 checksum
How to use checksums
44b6245c7de1556dbec287c0e39816d9769c3dbda0bd72886d445567fc73d45c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

Release files / roxxel-0.9.14-py3-none-any.whl

Download URL roxxel-0.9.14-py3-none-any.whl
Size 23.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a35a412f9214c6c083c9b4deb816d7370d3311311bbb74346c6e191d3bc56bc3
BLAKE2b-256 checksum
How to use checksums
d46abb6c877537c872b2642743701603935793d509ead426b85b96b1ca85bf6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

Security for roxxel 0.9.14

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for roxxel-0.9.14.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

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.9.14 This release

2 release files Full 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