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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pipenaut-0.1.2.tar.gz
  • Upload date:
  • Size: 616.6 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.2.tar.gz
Algorithm Hash digest
SHA256 76791a70711708af32c8aa20865b599009ea50741a8384e2a405fd88c29d972b
MD5 0135db9348019163d31e54b5f38a58e8
BLAKE2b-256 fad65de77f0aea6f16c2bff81b0a0af6dc3ac51145562660170a14c21c1c887b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pipenaut-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0516622c79bd64c763fbd020320810aea5e288bb265e47f15ad9a28be274ac53
MD5 93e25948995f10fa62d6412a9d1aa9b6
BLAKE2b-256 1c8ff164fc11491496f43bdea3ea7083432417127b5317c17f8f7d84a05ea3a3

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