Skip to main content

Delta compression utilities used by the Fireworks AI hot-load and incremental snapshot pipelines

Project description

fireworks-delta-compression

Delta compression utilities used by the Fireworks AI serving stack to ship incremental model weight updates (hot-loads) over the wire.

This package exposes the same compression / decompression backends that the Fireworks serving servers use internally, so you can produce or consume deltas on the customer side without copy-pasting source from the monorepo and without risk of dependency version drift.

Install

pip install fireworks-delta-compression

Quick start

import torch
from fireworks_delta_compression import (
    delta_compress,
    delta_decompress,
)

src = torch.randn(1024, 1024, dtype=torch.bfloat16)
dst = src + 1e-3 * torch.randn_like(src)

compressed_diff, checksum = delta_compress(
    src=src,
    dst=dst,
    compression_format="arc_v3",
)

restored = delta_decompress(
    src=src,
    compressed_diff=compressed_diff,
    checksum=checksum,
    compression_format="arc_v3",
)
torch.testing.assert_close(restored, dst)

Supported compression formats

Format Backend
arc_v1 XOR diff + zlib
arc_v2 XOR diff + zstd
arc_v3 ARC v3 (typed, multi-strategy)

Higher-level helpers

  • delta_compress_dicts_to_file / delta_decompress_dict_from_file — work on dict[str, torch.Tensor] and persist to safetensors with checksums in the metadata block.
  • delta_compress_files_to_file — read two safetensors files and write the delta out as a third safetensors file.
  • delta_compress_dirs / decompress_delta_into_source — walk a directory of safetensors shards in parallel.
  • delta_decompress_inplace — mmap-based in-place decompression that rewrites the base safetensors file with the diff applied (no extra RAM copy).

Versioning

Dependencies (torch, safetensors, numpy, zstd) use loose compatible- release pins so this wheel installs cleanly alongside customer code. The upper bounds (<3, <1, <3, <2) protect against silent breakage from major-version upgrades; bump them after validating against a new server release.

License

MIT — see LICENSE.

Project details


Download files

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

Source Distribution

fireworks_delta_compression-0.1.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

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

fireworks_delta_compression-0.1.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file fireworks_delta_compression-0.1.0.tar.gz.

File metadata

File hashes

Hashes for fireworks_delta_compression-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fdc649b28e4dddd0913761f2f2ca98a3423a5fe9f818135cf4950bba2e888097
MD5 e43052571b71e15524b3d79d25dfbbda
BLAKE2b-256 8969bfc8f89a267e8c773f3a33633100f7cfa379e54b6d5ed4d2080668a42bb3

See more details on using hashes here.

File details

Details for the file fireworks_delta_compression-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fireworks_delta_compression-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24a568d31ff2b460ce2724b825a2478dbeba36b511fdfc6543f28f4a39ece4b0
MD5 b1435fdb07d77d3335055c98852d0f12
BLAKE2b-256 f3b791c6c8af4308b55a101d12df6be9203a5834a67b73d0b33f5a8d0354c308

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page