Skip to main content

ML Goodput Measurement

PyPI Python License

Goodput is the share of a training workload's wall-clock time spent on preserved, productive work: training steps that completed and were not lost to a restart or rollback. Badput is the remainder, attributed to its cause: accelerator initialization, program startup and compilation, data loading, checkpoint save and restore, evaluation and other custom events, disruptions and the progress they wasted. It is a workload-level metric: one number for the whole job, across all hosts and restarts, computed from the job's own timeline. Goodput says how much accelerator time became training progress; the Badput breakdown says what to fix.

ml-goodput-measurement records the timestamps that define these intervals from any Python training loop (JAX, PyTorch, or any other framework), stores them in Google Cloud Logging, and computes Goodput, the Badput breakdown and step-time deviation on demand or continuously, with export to TensorBoard and Google Cloud Monitoring for dashboards and alerting.

Install

pip install ml-goodput-measurement

Requires a Google Cloud project with the Cloud Logging API enabled; see Prerequisites.

Quick start

from ml_goodput_measurement import goodput

# Record from exactly one process per job (the lead process).
recorder = goodput.GoodputRecorder(
    job_name=run_name, logger_name=f"goodput_{run_name}", logging_enabled=is_lead
)
recorder.record_job_start_time()
for step in range(num_steps):
  recorder.record_step_start_time(step)
  train_step()
recorder.record_job_end_time()

# Compute from anywhere with access to the project's logs.
calculator = goodput.GoodputCalculator(
    job_name=run_name, logger_name=f"goodput_{run_name}"
)
goodput_pct, badput, last_step = calculator.get_job_goodput(
    include_badput_breakdown=True
)

A 100-step run with checkpoints every 25 steps reports, for example:

% of wall-clock
Goodput 52.5
PROGRAM_STARTUP 20.0
UNPRODUCTIVE_CHECKPOINT_SAVE_TIME 11.7
OTHER 8.0
TRAINING_PREP 4.3
DATA_LOADING_SYNC 3.5

Recording the optional intervals (initialization, data loading, checkpointing, custom events such as evaluation) attributes more of the Badput; GoodputMonitor uploads the numbers while the job runs. For asynchronous backends such as PyTorch on TPU, StepClock takes step boundaries from accelerator events.

How it works

  • GoodputRecorder runs in the training process on the lead host and writes timestamped entries to Cloud Logging; nothing blocks the training loop.
  • GoodputCalculator reads the job's entries from anywhere with access to the project, keeps a local cache, and computes Goodput, the Badput breakdown and step-time deviation.
  • GoodputMonitor runs the calculator on a schedule and uploads the results to TensorBoard and Google Cloud Monitoring.

Guides

Integrations

  • MaxText (JAX): reference integration

Releases

  • 0.2.5: monitor no longer freezes after a restart on the same host; late-visible log entries are read; StepClock, bounded final flush, min_step_time
  • 0.2.4: elastic restart and checkpoint calculation fixes; custom badput events in the last step are counted
  • 0.2.3: GCS cache sync for faster cold-start reads

Full history in CHANGELOG.md.

Contributing and support

See CONTRIBUTING.md. Questions and bug reports: GitHub issues. Apache-2.0 licensed.

Metadata

Release files for ml-goodput-measurement 0.2.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 ml-goodput-measurement 0.2.5
File Size Uploaded Provenance Actions
ml_goodput_measurement-0.2.5.tar.gz 113.2 kB Without provenance Details for ml_goodput_measurement-0.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ml-goodput-measurement 0.2.5
File Interpreter ABI Platform Actions
ml_goodput_measurement-0.2.5-py3-none-any.whl Python 3 none any Details for ml_goodput_measurement-0.2.5-py3-none-any.whl

Total release size: 239.5 kB

Release files / ml_goodput_measurement-0.2.5.tar.gz

Download URL ml_goodput_measurement-0.2.5.tar.gz
Size 113.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4dcd8f5e6a7ebac7ab56cd8922c04e03fa01b74b6ce16b38510cabc42abde6d5
BLAKE2b-256 checksum
How to use checksums
675956166e62bdcbe1cf09304dde22ab0e2f319f5beebd898e1d0f0233beac61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / ml_goodput_measurement-0.2.5-py3-none-any.whl

Download URL ml_goodput_measurement-0.2.5-py3-none-any.whl
Size 126.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f29fa48a183d0bb8d15eab8bf6b4b3b93ed99874ea9f3b108b274547b66ad45
BLAKE2b-256 checksum
How to use checksums
7a843039fd75cff8de01a6a1784eb445a7b6344e1b5c5b7ec5a818befcd7a6ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for ml-goodput-measurement 0.2.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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