Jabara
Theme

About Jabara

Jabara is a Python library that compresses the checkpoints of a training run: the model weights and the optimizer state. Lossless compression, deltas against an earlier checkpoint, and quantization all sit behind one codec interface.

Written by Tatsuki Okada. Version 0.1.0, under the MIT License. Jabara is not on PyPI yet, so you install it from a clone of the repository.

What Jabara does

Point jabara compress at a checkpoint directory. It replaces each *.safetensors file and optimizer.pt with a .jbr archive, verifies every archive, and only then deletes the originals. It leaves the other files alone. jabara decompress writes the original files back.

It reads a file through a registry of checkpoint formats: safetensors, the torch.save files of Transformers, Accelerate, PyTorch Lightning, DeepSpeed, and Megatron-LM, NumPy .npy and .npz, GGUF, and Keras .keras and HDF5 files. Each format is one class that cuts the tensors out of the file and puts them back, so a lossless archive restores the file byte for byte, and a new format is one more class. The formats reference lists them, with the formats that Jabara does not take and why.

From Python, save_state and load_state in jabara.torch store and restore a PyTorch state, such as the state_dict() of an optimizer. The adapters do the same inside the checkpoint save of a Hugging Face Trainer or a PyTorch Lightning Trainer.

By default every tensor comes back bit for bit, and every read checks a CRC-32 for each chunk. Writing an archive with a lossy codec requires allow_lossy=True, and the archive then records the largest error that the codec introduced.

Who it is for

A checkpoint holds more than the model. With Adam, every weight has two moment tensors of its shape, exp_avg and exp_avg_sq. When all three use one dtype, the optimizer state takes about twice the space of the weights. A run saves such a checkpoint again and again, and a sweep of N runs that each keep K checkpoints stores N × K of them.

Jabara is for checkpoints that you keep and read back later:

  • The checkpoints of seed sweeps and hyperparameter searches. Jabara compresses each one on its own. Runs that start from the same pretrained weights can also store their weights as a delta against those weights, but how much that saves has not been measured.
  • Long runs on preemptible or time-limited machines, which save often and resume from the archives with every tensor bit for bit.
  • Intermediate checkpoints kept for analysis, such as probing or picking the best step afterwards, which get back the exact tensors.
  • Runs that someone else resumes, which a release of the weights alone does not allow.

It is not a format to serve a model from. A framework cannot memory-map an archive, so Jabara decodes it before the framework reads it, and saves and loads take longer than without Jabara. Who Jabara is for gives the measured sizes and costs, and Jabara and general-purpose archivers compares it with tar, zip, gzip, and zstd.

Lossless compression, deltas between checkpoints, and quantization are known methods, and Jabara adds no new one. It gives them one interface, so that you use them, compare them on the same tensors, and add your own in the same way. jabara.bench measures each codec it is given on the same tensors: the stored size, the encode and decode time, and whether each tensor decodes to the same bytes.

Lossless is the default because a run should resume as if nothing had happened. A checkpoint that restores approximately cannot promise that, so you choose a lossy codec in code, per tensor, and opt in with allow_lossy=True.

How a checkpoint becomes an archive

From a checkpoint directory to a .jbr archiveA checkpoint directory holds model.safetensors and optimizer.pt. A state schema gives each tensor a role: weight, adam_m, adam_v, or step. An assigner picks a codec for each tensor, such as bytegroup-zstd/1, zstd/1, xor-delta/1, or the lossy quant8-linear/1, which an archive accepts only with allow_lossy=True. Each tensor is split into chunks of 16 MiB, each with a CRC-32. Each file becomes its own archive, which holds a magic number, the chunks, the JSON index, its length and CRC-32, and a closing magic number, and a reader starts from the end.Checkpoint directorymodel.safetensorsoptimizer.ptA state schema names the role of each tensorTensors, each with a roleweightadam_madam_vstepAn assigner picks a codec for each tensorCodecs, one per tensorbytegroup-zstd/1zstd/1xor-delta/1quant8-linear/1lossy: needsallow_lossy=TrueChunks of 16 MiB, each with a CRC-32One archive per file, such as optimizer.pt.jbrmagicchunkchunk…indexlenCRCendA reader starts from the end
Each checkpoint file becomes its own archive. jabara compress picks bytegroup-zstd/1 or zstd/1, or xor-delta/1 when you pass --base. You choose a lossy codec from Python. The four codecs shown are half of the built-in ones.
  1. Roles. A state schema names the role of each tensor from its path in the saved state. OptimizerSchema gives exp_avg the role adam_m, exp_avg_sq the role adam_v, and step the role step. Every tensor of a safetensors file is a weight.
  2. Codecs. An assigner chooses a codec for each tensor. By default, float tensors go to bytegroup-zstd/1 and all other tensors to zstd/1. RoleAssigner chooses by role, so the weights and each kind of optimizer state can use different codecs. A delta codec such as xor-delta/1 stores a tensor as its difference from the same tensor of its base, a full archive of an earlier checkpoint.
  3. Chunks. The writer splits each tensor into chunks of 16 MiB by default and codes them on a pool of threads threads. Each chunk carries a CRC-32 of the bytes that a reader must produce.
  4. Archive. One .jbr file holds a magic number, the chunks, a JSON index, the length and the CRC-32 of the index, and a closing magic number. The index lists every tensor with its dtype, shape, role, codec, and chunks. A reader starts from the end of the file and rejects a file that it does not understand before it reads a chunk.

The archive format reference gives every field, and the design document fixes the data shapes and module boundaries.

What the repository contains

The library
The jabara package for Python 3.10 or newer: the archive writer and reader, eight built-in codecs, the assigners and state schemas, and the PyTorch layer. See the Python API.
The command
jabara compress, decompress, ls, verify, export-weights, bench, and codecs. See the command-line reference.
Framework adapters
jabara.hf.attach for the Hugging Face Trainer and JabaraCheckpointIO for PyTorch Lightning. Each needs its extra, hf or lightning.
The live demo
The library running in your browser through Pyodide, on a bundled checkpoint or on a safetensors file that you choose. Nothing is uploaded. Open the demo.
The results viewer
The reports of jabara.bench as tables, one for each tensor role: measured reports on the checkpoints of language-model training runs, and one synthetic report from seeded random tensors. Open the results viewer.
Documentation
A tutorial, how-to guides, explanations, and the reference, in English and 日本語.
Examples
Complete scripts in examples/extend/ that add a codec, an assigner, and a state schema. A test runs each one.

What Jabara does not do

  • It does not introduce a compression method, and it does not aim to beat other codecs on stored size.
  • It does not compress on a GPU. It runs on the CPU inside the training loop, and a save returns once the archive is written.
  • The Trainer adapter refuses multi-process training, DeepSpeed, and FSDP.
  • The Lightning plugin reads and writes local paths only.
  • Jabara runs no pickle. The archives of its training adapters hold tensors, plain values, and dicts, lists, and tuples of them, and refuse a custom object. A file that torch.save wrote is taken apart without being unpickled, and comes back byte for byte.
  • The codec interface codes one tensor at a time. A method that codes several tensors together, such as one that prunes weights together with their optimizer moments, does not fit it.
  • jabara bench times the codec's share of the work, in memory, not a whole save or load.

The scope page gives the reason for each.

License

The code is under the MIT License. The text font of this site, BIZ UDPGothic, and its code font, JetBrains Mono, are under the SIL Open Font License. The demo downloads the Pyodide runtime from cdn.jsdelivr.net after you press its button.

How to cite Jabara

Cite the repository. Replace COMMIT with the commit you used, because the code still changes.

BibTeX
@misc{okada2026jabara,
  author       = {Tatsuki Okada},
  title        = {Jabara: A unified library for compressing {LLM} training checkpoints},
  year         = {2026},
  howpublished = {\url{https://github.com/iamtatsuki05/jabara}},
  note         = {Version 0.1.0, commit COMMIT}
}

Jabara is written by Tatsuki Okada, iamtatsuki05 on GitHub. Report a bug or ask a question in the issue tracker.