Skip to main content

Experience pipeline parallelism on your laptop. Naive, GPipe, 1F1B — one command.

Project description

Pipenaut

PyPI version License: MIT Python 3.10+

Experience pipeline parallelism on your laptop. Naive, GPipe, 1F1B — one command.

No GPUs needed. No cluster setup. just pip install and run.


Under the Hood

Visualizing how data flows through a pipeline is key to understanding efficiency.

Pipenaut Workflow


Quick Start

pip install pipenaut

# Compare all 3 pipeline schedules side-by-side
pipenaut compare --workers 4

# Run a specific schedule with detailed logs
pipenaut run --schedule 1f1b --workers 4 --steps 20

# Learn how a schedule works
pipenaut explain 1f1b

Supported Schedules

Pipenaut implements three classic pipeline parallelism strategies. You can visualize them directly in your terminal with pipenaut explain <schedule>.

1. Naive (Stop-and-Wait)

The simplest approach. Process one batch at a time through all stages. Massive idle time ("bubble").

[Rank 0] ████░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓
[Rank 1] ░░░░████░░░░░░░░░░░░░░░░▓▓▓▓░░░░
[Rank 2] ░░░░░░░░████░░░░░░░░▓▓▓▓░░░░░░░░
[Rank 3] ░░░░░░░░░░░░████▓▓▓▓░░░░░░░░░░░░

██ = Forward  ▓▓ = Backward  ░░ = Bubble (idle)

2. GPipe (Micro-batched)

Splits the batch into smaller "micro-batches". Pushes all micro-batches forward, then all backward. Much better utilization.

[Rank 0] ████████░░░░░░░░░░░░▓▓▓▓▓▓▓▓
[Rank 1] ░░████████░░░░░░░░▓▓▓▓▓▓▓▓░░
[Rank 2] ░░░░████████░░░░▓▓▓▓▓▓▓▓░░░░
[Rank 3] ░░░░░░████████▓▓▓▓▓▓▓▓░░░░░░

██ = Forward  ▓▓ = Backward  ░░ = Bubble (idle)

3. 1F1B (One Forward, One Backward)

The industry standard (used in Megatron-LM, DeepSpeed). Interleaves forward and backward passes to keep the pipeline full and memory usage low.

[Rank 0] ████████▓▓██▓▓██▓▓██▓▓██▓▓▓▓▓▓▓▓
[Rank 1] ░░██████▓▓██▓▓██▓▓██▓▓██▓▓██▓▓▓▓▓▓░░
[Rank 2] ░░░░████▓▓██▓▓██▓▓██▓▓██▓▓██▓▓██▓▓▓▓░░░░
[Rank 3] ░░░░░░██▓▓██▓▓██▓▓██▓▓██▓▓██▓▓██▓▓██▓▓░░░░░░

██ = Forward  ▓▓ = Backward  ░░ = Bubble (idle)

Comparison

Schedule Strategy Bubble Overhead
Naive Forward all → Backward all (sequential) ~75%
GPipe Forward all chunks → Backward all chunks ~43%
1F1B Interleave forward and backward ~19%

Usage Reference

pipenaut run flags

Flag Default Description
--schedule, -s 1f1b Schedule: naive, gpipe, 1f1b
--workers, -w 4 Number of pipeline stages
--steps 30 Training steps
--chunks, -c 8 Micro-batches (for GPipe/1F1B)
--batch-size 32 Global batch size
--dim 128 Model hidden dimension
--layers 16 Total model layers

📄 License

MIT © Vedant Shirgaonkar

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

pipenaut-0.1.5.tar.gz (617.5 kB view details)

Uploaded Source

Built Distribution

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

pipenaut-0.1.5-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file pipenaut-0.1.5.tar.gz.

File metadata

  • Download URL: pipenaut-0.1.5.tar.gz
  • Upload date:
  • Size: 617.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for pipenaut-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e4eb1acda728e65ffb70d3b3d757c94a851f27f5f290e45d902fda6ff42208ee
MD5 82eab0d1d2840063403275eabb225cb8
BLAKE2b-256 739e02d485756a5b5044bffe7125323ec00c6fa02ec81318173ee93d65c3bddb

See more details on using hashes here.

File details

Details for the file pipenaut-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pipenaut-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for pipenaut-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7205a3bab50a7d0d906805ac1cc82bcd753e2caa0e5f4b7553f739baceb6dd4e
MD5 4e30624e664eae27e1dc7a52ece99564
BLAKE2b-256 f89af7ab31e22580167b1a6eb5c02637377ba8cbb1c494e7e648797eea546a08

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