Skip to main content

BLT Trainer

A pure functional PyTorch implementation of a 96-layer Byte Latent Transformer (BLT) with Muon + ScheduleFreeAdamW optimization and weighted multi-corpus datamix.

Features

  • Byte Latent Architecture: Vectorized entropy/surprise-based dynamic byte patching and cross-attention pooling.
  • Targeted Shard Downloading: Massive corpora (such as DCLM at 4TB+ and OpenWebMath at 16GB+) only download the necessary training shards (~400MB total) instead of the entire multi-terabyte repositories. Datasets are cached locally using Apache Arrow to prevent Hugging Face API rate-limiting during training.
  • Weighted Multi-Corpus Sampling:
    • DCLM Baseline (mlfoundations/dclm-baseline-1.0): ~100M token shard
    • FLAN Collection (Muennighoff/flan): Representative reasoning & QA shards
    • Wikipedia QA (microsoft/wiki_qa): Full split (~20MB)
    • OpenWebMath Reasoning (open-web-math/open-web-math): Initial shard (~130M tokens)
    • Ubuntu Dialogue QA (sedthh/ubuntu_dialogue_qa): Full split (~30MB)
  • Advanced Logging: Real-time throughput reporting with TPS (Tokens Per Second), Tokens Processed, step latency, and ETA.
  • Dual Optimizer Partitioning: Muon optimizer for 2D hidden projection matrices and Schedule-Free AdamW for 1D embeddings and norm weights.
  • Cut Cross-Entropy: Chunked sequence loss computation to eliminate peak VRAM spikes from materializing large vocabulary logits.

Installation

pip install -e .

Usage

Run Training

blt-train --batch-size 32 --block-size 512 --steps 10000 --device cuda

CLI Options

Flag Type Default Description
--steps int 10000 Total training steps
--batch-size int 8 Batch size per step
--block-size int 512 Byte context length
--streaming flag False Stream from Hugging Face instead of downloading locally (default: False, downloaded)
--cache-dir str None Custom directory to cache downloaded datasets
--dclm-shards int 1 Number of DCLM shards to download (default: 1, ~100M tokens)
--download-full-datasets flag False Download entire corpora (warning: DCLM is 4TB+)
--log-interval int 10 Frequency of progress logs in steps
--device str cuda (if available) else cpu Execution device
--compile flag False Enable torch.compile kernel fusion
--lr-muon float 0.02 Learning rate for Muon optimizer
--lr-adam float 1e-3 Learning rate for Schedule-Free AdamW

Logging Output

Logs include step progress, loss, Tokens Per Second (TPS), Tokens Processed, step latency, and estimated time of arrival (ETA):

Step 00010/10000 (  0.1%) | Loss: 6.4215 | TPS:  14,250.3 | Tokens: 40,960 (40.96K) | Step Time:   35.9ms | ETA: 00:05:55 | VRAM: 3.45GB
Step 00020/10000 (  0.2%) | Loss: 6.1023 | TPS:  14,310.0 | Tokens: 81,920 (81.92K) | Step Time:   35.7ms | ETA: 00:05:52 | VRAM: 3.45GB

Metadata

Release files for blt-trainer 0.1.5

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

Source distribution (sdist)

Source distribution for blt-trainer 0.1.5
File Size Uploaded Provenance
blt_trainer-0.1.5.tar.gz 13.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for blt-trainer 0.1.5
File Interpreter ABI Platform
blt_trainer-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 28.5 kB

Release files / blt_trainer-0.1.5.tar.gz

Download URL blt_trainer-0.1.5.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a477a0212bce7e1950f6dccbf03793f2337f12223af87eb61768ca33919df83c
BLAKE2b-256 checksum
How to use checksums
d824ea6b968bd7ad3cb5630de22c8daae6bf6cbded8a15c8bb5b6fc47bd65d46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / blt_trainer-0.1.5-py3-none-any.whl

Download URL blt_trainer-0.1.5-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95799fff9041cd88410d1c33e06048796251ea8db031e7ef1f232cb22d0a2a2f
BLAKE2b-256 checksum
How to use checksums
9881ddd08108b26876ea315d6ff6988cc9ec721145a05b39612ee13f13763803
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for blt-trainer 0.1.5

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.

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