Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

moonclip

Latest version: v0.4.2

Overview

Last scanned
26 Nov 2026
Published
26 Nov 2026
PyPI package Publisher: JHNMACHINE
0 Stars
0 Forks
18 Versions
6.5K Downloads
Rust Repo language

Scan summary

moonclip was last scanned on 26 Nov 2026 at version 0.4.2. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 18 versions; the latest 5 were published within 6 days (21–26 Nov 2026).
  • Findings: No rules fired in version 0.4.2.
  • Downloads: 6,480 downloads.

Versions

18 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.4.2 LATEST 26 Nov 2026 No rules fired
0.4.1 25 Nov 2026 No rules fired
0.4.0 25 Nov 2026 No rules fired
0.3.9 23 Nov 2026 Not shown
0.3.8 21 Nov 2026 Not shown

No rules fired in 0.4.2

Findings

Findings for v0.4.2. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.4.2; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Moonclip

A checkpoint engine for ML training, written in Rust with Python bindings. It compares each tensor with the previous checkpoint, skips the ones that did not change, stores the others as a compressed XOR delta, and writes in the background, so a save holds the training loop only for the copy of the tensors.

On dense pre-training, the least favourable case because Adam changes every parameter at every step, a save held the loop for 0.2 s where torch.save and torch's DCP took 1.1-2.7 s, and wrote a fifth less (measured, with the command that reproduces it). Fine-tuning, LoRA and adapters leave most tensors unchanged between checkpoints and should gain more; that has not been measured. The design follows DECK (Meta, PVLDB 2025).

import torch
from moonclip import CheckpointManager

torch.manual_seed(0)
model = torch.nn.Sequential(torch.nn.Linear(16, 64), torch.nn.ReLU(), torch.nn.Linear(64, 1))
optimizer = torch.optim.AdamW(model.parameters(), lr=1e-3)
scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=1000)

mgr = CheckpointManager("./checkpoints")
start_step = mgr.resume(model=model, optimizer=optimizer, scheduler=scheduler)
print(f"starting at step {start_step}")

for step in range(start_step, 5_000):
    x = torch.randn(32, 16)
    loss = torch.nn.functional.mse_loss(model(x), x.sum(dim=1, keepdim=True))
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    scheduler.step()
    if step % 500 == 0:
        mgr.save(step=step, model=model, optimizer=optimizer, scheduler=scheduler,
                 metadata={"loss": f"{loss.item():.4f}"})
        print(f"step {step}  loss {loss.item():.4f}")

mgr.flush()

It runs as it is, on a CPU, in a few seconds. Stop it with Ctrl-C part way and run it again: it starts after the last step it saved.

resume() loads the latest checkpoint and returns the step after it, or 0 when there is none. save() returns once the tensors are copied; hashing, delta detection, compression and the write run on a background thread. Call flush() when the checkpoint has to be on disk, which means fsynced; loads and list_snapshots() wait for pending saves on their own, and async_save=False makes every save synchronous.

Install

pip install moonclip

Wheels exist for Linux on x86_64 and aarch64 (manylinux_2_28, so GH200, Grace and Graviton too) and for macOS on Apple silicon, CPython 3.11-3.14. On Python 3.10 or older pip may install 0.0.8 or earlier instead of refusing, since those said they ran on 3.9: check python --version, or ask for "moonclip>=0.3", which turns that into an error naming the Python version. On any other platform pip finds no wheel and the package has to be built, which needs a Rust toolchain:

pip install git+https://github.com/gpuzero-dev/moonclip.git

import moonclip does not import torch: the Rust engine stores named tensors and knows nothing about PyTorch, and CheckpointManager, the layer that knows what a state_dict is, is loaded the first time it is used.

What a checkpoint holds

  • Deltas. An unchanged tensor costs no I/O. A changed one is stored as an XOR delta against the previous checkpoint when that is smaller than storing it whole (delta_max_ratio), and a full snapshot is taken periodically (full_every_steps). A background thread merges delta chains so that a load does not have to replay a long one.
  • Compression. zstd, with large tensors split into frames compressed on every core.
  • Precision. save_dtype="bf16" (or fp16) casts floating-point tensors before compression and casts them back on load; a mapping applies a different dtype per name pattern. fp8 quantizes to one byte per element against a per-tensor scale, which is for archived copies rather than checkpoints you resume from. Tensors that already are float8 are stored bit-exact.
  • Integrity. Every tensor carries an xxHash3-128 checksum that is checked on read.
  • Retention. max_full_snapshots and max_total_snapshots bound what is kept on disk.

S3

The local directory stays the primary copy, so a save is as fast as the disk; a bucket (S3, R2, MinIO or any S3-compatible server) receives it in batches in the background:

mgr = CheckpointManager(
    "./checkpoints",
    s3_bucket="my-bucket",
    s3_endpoint="https://<account>.r2.cloudflarestorage.com",  # omit for AWS
    s3_path_style=True,
    sync_every_n_saves=5,
)

Credentials, in this order, the first that is there:

  1. s3_access_key and s3_secret_key (and s3_session_token) passed in.
  2. MOONCLIP_S3_ACCESS_KEY, MOONCLIP_S3_SECRET_KEY and, for temporary credentials, MOONCLIP_S3_SESSION_TOKEN; then the AWS_* names every S3 tool reads. Each pair is taken whole, never half from one set of names and half from the other.
  3. A profile in the shared credentials file: AWS_PROFILE, else default, in AWS_SHARED_CREDENTIALS_FILE, else ~/.aws/credentials. Its keys only: a profile in ~/.aws/config that assumes a role or uses SSO is not followed.
  4. The machine's role, with no key anywhere: a web identity (AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN, as EKS sets them), the container's credentials (ECS, EKS Pod Identity), or the EC2 instance profile through IMDSv2. These expire, and are fetched again before they do, so a run longer than their life keeps writing. AWS_EC2_METADATA_DISABLED=true skips the instance metadata service.

Keep keys out of the command line, where ps and the shell's history keep them: the environment, a profile or a role. Objects are written without per-request encryption headers, so the bucket's default encryption (SSE-S3 or SSE-KMS) is what applies.

Requests. A sync uploads each file the bucket does not have yet, one PUT each, and lists the prefix once. With Ravex's default of a delta at every step, a sync every 100 steps of a small model is in the order of 200 PUTs: on AWS, about a tenth of a cent. sync_every_n_saves trades that against how much a lost machine costs. The syncs say nothing unless MOONCLIP_LOG=debug; failures are always printed.

restore_from_remote() brings a store with an empty local directory back from the bucket.

Trust. Restoring a checkpoint unpickles part of it: optimizer and scheduler state, and the metadata of each state dict. Anyone who can write to the directory or the bucket can therefore run code in the process that restores from it, as with torch.load(..., weights_only=False). Give write access to a checkpoint bucket only to what you would let run code on your training machines, and do not restore checkpoints from a source you do not trust.

moonclip.Bucket is the same client for plain files: whole objects by path (get, put, list), with no manifest and no tensors, for whatever has to sit next to the checkpoints.

Measured

python examples/compare_savers.py trains the same model with each saver and prints this table. One run, 50M parameters with AdamW in fp32, a save every 5 steps, 8 saves, on a 4-core x86_64 cloud VM with no GPU, torch 2.15. Only the first time column stops training. The second is Moonclip's background write: it runs while training goes on, ends after the last save, and only flush() waits for it.

saver blocked per save (median) background write, after the last save written per save
torch.save 2,694 ms none 576 MiB
torch DCP (dcp.save) 1,135 ms none 577 MiB
Moonclip 226 ms 4,311 ms 467 MiB

"Blocked" is what the training loop waits for: the whole save for the first two, the copy of the tensors for Moonclip, whose write runs in the background while training goes on. On this shared VM torch.save varied between 1.7 and 3.6 s from run to run, and Moonclip between 0.2 and 0.5 s. Every parameter changes at every step here, so the deltas save only a fifth; save_dtype halves what is left, and on a GPU the copy that blocks is a device-to-host transfer. Run it on your own model and machine (--width, --layers, --device cuda) before trusting any of these numbers for yours.

Next to other tools

  • Lightning, Accelerate, the Hugging Face Trainer: Moonclip does not plug into their checkpoint hooks, which keep calling torch.save, safetensors or DCP. To use Moonclip with any of them, call CheckpointManager.save() yourself where you want a checkpoint, or put Ravex around the training function. Otherwise, keep their own checkpointing.
  • torch DCP saves a sharded model in parallel and reloads at another world size; it writes the whole state every time and, unless asked for its async mode, blocks while it does. Moonclip writes only what changed, in the background, and keeps a history of checkpoints rather than one.
  • W&B, MLflow track metrics and keep artifacts. They live beside Moonclip: the checkpoints stay in your directory or bucket, and the tracker records what you log.

More than one rank

Say which topology the manager is for. Under torchrun, "auto" takes it from the launcher:

mgr = CheckpointManager("./checkpoints", world_size="auto", rank="auto")

The ranks then share one store, through the create_snapshot / save_rank / finalize_snapshot flow. If each rank writes to a directory of its own instead, every one of them is single-rank and says so:

mgr = CheckpointManager(f"./checkpoints/rank_{rank}", world_size=1, rank=0)

Leaving the topology unsaid under a multi-rank launcher is an error that names both numbers. Adopting the launcher's variables silently made the same code save under python train.py and refuse under torchrun, decided by nothing the code could see. A single process needs no configuration.

Environment

MOONCLIP_THREADS Size of Moonclip's own thread pool. Default: the cores divided by LOCAL_WORLD_SIZE, so that the ranks on one node share the machine instead of each claiming all of it.
MOONCLIP_PROFILE=1 A per-phase breakdown of each save on stderr, and a line whenever a save waited for the previous one.
MOONCLIP_FSYNC=0 Skips the fsync before a pack is renamed into place. Faster, but a power loss mid-save can leave a pack of the right length full of zeros that the manifest vouches for.
MOONCLIP_NO_PINNED_STAGING=1 Copies GPU tensors through ordinary memory instead of pinned buffers, for a box where host RAM is the constraint.
MOONCLIP_LOG=debug Also logs the syncs that went well, and the snapshots a restore left out because a sync had not carried them whole yet; errors are logged either way.

Versioning and compatibility

Moonclip is 0.x. Within it:

  • A patch release (0.3.x) never changes the format on disk and never removes anything.
  • A minor release (0.x) may change the format. A newer Moonclip opens every store an older one wrote, and moves it to the new layout at its next save; an older Moonclip may refuse a store a newer one wrote, and says so. The CHANGELOG marks every format change in bold, with its version.
  • What is removed is deprecated first, with a warning, for at least one minor release.
  • Python 3.11 and later, each for as long as CPython supports it; a version is dropped in a minor release. Rust: the rust-version in Cargo.toml.

Pin a minor version (moonclip~=X.Y.0, with the minor you run) on machines that share a store, so that none of them writes a format another cannot read.

Moonclip and Ravex

Moonclip is the storage layer under Ravex, and the line between them is that Moonclip is the checkpoint manager and Ravex the runtime. Moonclip decides how a checkpoint becomes files and where they go, bucket keys included, and how often to save between two checkpoints, from what saving costs (window_steps). Ravex decides when a checkpoint is due and what goes in it, puts the result back into a live training process, and coordinates one or more machines; it carries no storage code of its own. To Moonclip a rank is only a number on a snapshot. Moonclip works on its own as well, as in the examples above.

GPU Zero is a hosted service built on both: it shows a run's metrics and checkpoints, resumes or forks it from any checkpoint, and starts GPUs in your own cloud account for it. Neither library needs it, and nothing is sent to it unless a run is configured to send it.

Development

cargo test                                      # Rust tests, no Python needed
maturin develop --release && pytest tests/ -v   # Python and PyTorch tests
cargo clippy --all-targets -- -D warnings       # what CI gates on

rust-toolchain.toml pins the same compiler as CI, so that a red clippy here means a red gate there. It is not the MSRV, which is rust-version in Cargo.toml. The crate is deliberately not cargo fmt-clean: the gate is clippy. What changed between versions is in the CHANGELOG, and runnable examples (a plain model, a transformer, DDP, S3) are in examples/.

License

Apache-2.0 — GPU Zero

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases moonclip

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

Vulnerability Insights

Compromised Claude Code extensions (versions 2.1.312 & 2.1.313) in Cursor try to install a backdoor

Frame 2085668439 (1)
Group 1261154229