How does Petals' BitTorrent-style distributed LLM serving work?

Updated

Petals lets you run large language models such as Llama 3.1 (up to 405B), Mixtral (8x22B), Falcon (40B+), or BLOOM (176B) without owning enough GPU memory for the whole model. Instead of loading every weight locally, you load a part of the model and join a network of other people who are serving the remaining parts. A single inference request is then completed collaboratively across those machines, in a way that resembles BitTorrent's piece-by-piece sharing. This is a good fit if you want to generate text or fine-tune a very large model on a consumer-grade GPU or Google Colab, and can accept the latency of a distributed network.

The core mechanism

The model is split into blocks, and each participant is responsible for holding and serving some of those blocks. When you run a forward pass:

  1. Your machine holds the blocks assigned to you (or the ones you choose to load).
  2. For the blocks you don't hold, your request is routed to peers in the network who do hold them.
  3. Activations pass from block to block across machines until the full forward pass is complete.

From your side this feels like calling an API, but under the hood you still have the flexibility of PyTorch and 🤗 Transformers. That means you are not limited to a fixed text-in/text-out interface: you can use custom fine-tuning and sampling methods, execute custom paths through the model, or inspect its hidden states.

What performance to expect

The published reference numbers are for single-batch inference:

Model Reported single-batch speed
Llama 2 (70B) up to 6 tokens/sec
Falcon (180B) up to 4 tokens/sec

Those rates are described as enough for chatbots and interactive apps. The important qualifier is single-batch: this design targets low-concurrency, interactive use, not high-throughput batch serving. If your workload is many parallel requests, the peer-to-peer routing becomes the bottleneck rather than a benefit.

When this approach makes sense

Choose Petals-style serving when:

  • The model is too large to fit on your own GPU, but you still want to run it.
  • You are doing interactive generation or experimentation where a few tokens per second is acceptable.
  • You want fine-grained control (custom sampling, custom forward paths, hidden-state access) rather than a locked API.
  • You are willing to depend on other participants being online for the parts you don't hold.

Avoid it when:

  • You need high request throughput or strict, predictable latency.
  • You need guaranteed availability independent of a peer network.
  • Your task requires the entire model to be resident locally at all times.

Getting started

The project points to two entry points: a Colab notebook for trying it immediately, and documentation on GitHub. The practical path is to start in Colab, load a portion of a supported model, and let the network serve the rest. If you want to give back, you can also contribute your own GPU to host blocks for others.

One thing to note from the site itself: the live "top contributors" and network status panel can fail to load ("Oops, can't load the network status..."), so don't treat that widget as a reliable indicator of current network health.