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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pipenaut-0.1.6.tar.gz
  • Upload date:
  • Size: 616.8 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.6.tar.gz
Algorithm Hash digest
SHA256 b88ff0e45b83b4e0f61cdcc6596ebe377bd1e7dbce577b9c00406f50382b5dc5
MD5 0e6c2c0e122d51da395df4eab6829400
BLAKE2b-256 b9e4ea871ac6e64bca5fac5bfd1a63d0c14c93b46a4bc4d0a65825d2bdb46bc0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pipenaut-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 19.0 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c4e7b62fe95a8e68a0388b35ab7d94150587d7eea622ed07fd2081627591f3e2
MD5 55ba22839da38b1766476fe6cc002687
BLAKE2b-256 5e7998572e978c013b87dd37e91eeba798f9e3089ac3ff11a5de1f416a069197

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