Skip to main content

PulseGrad (pug)

Live training telemetry and CLI for PyTorch.

License: Apache 2.0 Python 3.11+ Docs

Training instability — loss spikes, dead adapters, vanishing gradients, precision underflow — shows up first in the gradient/weight/activation stream, not the loss curve. By the time loss visibly degrades you have often lost minutes to hours of compute. PulseGrad instruments the optimizer step boundary directly and turns that stream into localized, typed findings rather than raw numbers a human has to interpret.

Status: early development. The collector core (hooks, stat reducers, local SQLite store, CLI) is implemented. Read the roadmap before depending on this in production.

Install

pip install pulsegrad

PyTorch is a peer dependency — PulseGrad never installs or pins it, so your existing CUDA/ROCm/CPU build is left exactly as it is. Bring your own torch.

For Hugging Face integrations (transformers, peft):

pip install "pulsegrad[hf]"

Quickstart

import pulsegrad as pug

pug.init()  # one line, before training starts — that's all

for batch in loader:  # a completely vanilla loop, no pulsegrad calls
    loss = model(batch).loss
    loss.backward()
    optimizer.step()
    optimizer.zero_grad()

Model, optimizer, steps, loss, learning rate, and end-of-run status (completed/crashed, even on unhandled exceptions) are discovered and recorded automatically — no per-step calls, no close().

When auto-discovery cannot identify the right model — and it says so loudly when that happens — pulsegrad.watch(model, optimizer) is the explicit form. Both return the same Session.

Then, from a shell:

pug ls        # runs recorded so far
pug summary   # one-screen report on the latest run

What the collector does

  • Zero-touch capture — gradients read at the optimizer-step boundary (post-accumulation, semantically final), weights post-step, activation stats via sampled forward hooks. Per-module rows go to a local SQLite store behind a non-blocking writer thread.
  • Multi-model training (GAN, DPO, distillation) — call watch() once per model; each gets its own run. Losses are scoped to the correct run by walking the loss tensor's autograd graph.
  • DDP-aware — under torchrun, only rank 0 records, since post-allreduce gradients and weights are identical across ranks. Other ranks get an inert session, so the same script runs unmodified. PULSEGRAD_ALL_RANKS=1 opts into per-rank runs.
  • Post-hoc CLI summarypug summary prints status, loss trajectory, NaN/Inf health with the first offending step and modules, top grad-norm modules, dead activations, and throughput.
  • Kill-switchPULSEGRAD_DISABLED=1 makes the whole collector a no-op.

import pulsegrad resolves its public API lazily and does not import torch, so adding it to a script costs approximately nothing until you call init().

Known limitations

  • Multi-evaluation optimizer closures aren't supported yet. Optimizers whose step(closure) calls the closure more than once per step — torch.optim.LBFGS is the common case — desync PulseGrad's internal stats pairing and silently record no data for the affected steps. Training itself is unaffected; you just won't see anything in pug ls for that run. Tracked for a fix; everything else in this document is unaffected.

Documentation

  • Researcher guideinit()/ watch() usage, per-training-type guides, detector catalog.
  • Repository — design docs, benchmarks, and roadmap.

License

Apache-2.0. See LICENSE.

Release files for pulsegrad 0.1.0

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

Source distribution (sdist)

Source distribution for pulsegrad 0.1.0
File Size Uploaded
pulsegrad-0.1.0.tar.gz 860.2 kB Details

Built distribution (wheel)

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

Total release size: 1.8 MB

Release files / pulsegrad-0.1.0.tar.gz

Download URL pulsegrad-0.1.0.tar.gz
Size 860.2 kB
Tags Source
SHA-256 checksum
How to use checksums
54ed6ab78aae92671bf43e110c5c06df0325be7848b50e84f21c3255ca3d5f88
BLAKE2b-256 checksum
How to use checksums
36d145658408dca91f865dfae74ee51fb67e191f937629e336f6eb350a569aa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.4

Release files / pulsegrad-0.1.0-py3-none-any.whl

Download URL pulsegrad-0.1.0-py3-none-any.whl
Size 907.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd21d3d95f9adc19de95ba1aed106b849f65f2b6ee0599e1d9619a03afe8d5ce
BLAKE2b-256 checksum
How to use checksums
dd836783690c55754d5118b3d35e198d4f297ec7cd185d8af784a8baab253bbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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