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.7.tar.gz (617.1 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.7-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pipenaut-0.1.7.tar.gz
  • Upload date:
  • Size: 617.1 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.7.tar.gz
Algorithm Hash digest
SHA256 ea7d5cb8723925ffe4039eb79ae5a2b8454f679efe851aeb5e5c91d889bb9933
MD5 42bf6e70dbd4f73a18331551c9c1dba3
BLAKE2b-256 defea8131431ada311a9ddfc0ee0836fd99af2a409639ac921186a624970f1af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pipenaut-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 19.3 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ecc1d1ecbfc5f4eb04b853d1482ee1d11f16d052b8f0323104aa6a91ae7074d9
MD5 573d8f80e695932e3b5ffe34f6833a97
BLAKE2b-256 4817d082f2bc646be3c9aa0f97111789bee6389702d1c02a7009f92b923d80ff

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