TL;DR
Petals is a decentralized system that allows researchers and developers to run and fine-tune 100B+ parameter language models by pooling together the resources of multiple participants over the internet. Think of it as "BitTorrent for Large Language Models (LLMs)," enabling interactive-speed inference and flexible fine-tuning on consumer-grade hardware that would otherwise be far too weak to handle such massive models.
Introduction
Modern Large Language Models (LLMs) like BLOOM-176B or OPT-175B are game-changers for NLP, but they impose a massive "hardware tax." Running these models typically requires over 350 GB of high-end accelerator memory—hardware that is prohibitively expensive for most individual researchers or small labs.
Existing workarounds have major flaws:
- Offloading: Moving model parts between RAM and GPU is painfully slow (taking 5–20 seconds per token).
- Hosted APIs: Services like OpenAI are user-friendly but are "black boxes." Researchers cannot access internal hidden states, modify the model's control flow, or perform deep fine-tuning without high costs and restricted access.
Petals aims to bridge this gap by creating a collaborative "swarm" where users contribute small amounts of GPU memory to collectively host a giant model.
Methods
The authors treat the LLM as a sequence of blocks (Transformer layers) and distribute these blocks across a network of "servers" (participants).
The system relies on several key technical components:
- Pipeline Parallelism over the Internet: A client holds the model's initial embeddings locally. When they want to generate text, they send the data through a "chain" of servers, each of which processes a few layers before passing the result to the next server.
- 8-bit Quantization: To make this feasible over standard internet connections, Petals uses 8-bit compression (specifically
LLM.int8()) for both model weights and the "hidden states" passed between servers. This halves the bandwidth requirements and allows a server with just 8GB of VRAM to host several layers of a 176B model. - Distributed Hash Table (DHT): Using the
hivemindlibrary, the system maintains a decentralized registry of which servers are hosting which layers. This allows the system to automatically load-balance and route around servers that go offline. - Fault Tolerance: If a server in the chain fails, the client simply looks up a replacement in the DHT and resumes the process, ensuring the "swarm" remains resilient.
Evaluation and Datasets
The paper focuses on the system's performance using existing state-of-the-art models rather than introducing new datasets. They primarily evaluate using:
- BLOOM-176B: A massive open-access multilingual model.
- OPT-175B: Meta’s Open Pretrained Transformer.
- Benchmarks: To ensure 8-bit quantization didn't hurt accuracy, they tested on HellaSwag, LAMBADA, and WinoGrande.
Key Results
The evaluation demonstrates that Petals can achieve performance levels previously impossible for decentralized hardware.
- Inference Speed: On a setup of 14 real-world servers spread across Europe and North America, Petals achieved 0.83 steps/sec. In contrast, running the same model via RAM offloading on a single high-end machine takes over 5 seconds per step.
- Accuracy Parity: The 8-bit quantization used to save bandwidth resulted in virtually zero loss in zero-shot accuracy. For BLOOM, the average score across benchmarks was 70.3% (8-bit) vs 70.1% (16-bit).
- Fine-tuning Throughput: For parallel forward passes (used in training), Petals can process nearly 180 tokens/sec, making it a viable alternative to expensive GPU clusters for parameter-efficient fine-tuning.
Discussion and Future Work
Petals introduces a new paradigm for LLM accessibility. By allowing clients to "own" their specific trainable parameters (like LoRA adapters) while the swarm provides the heavy lifting, it enables "Distributed Fine-tuning."
However, challenges remain:
- Security: Currently, the system assumes servers are honest. A malicious server could return incorrect outputs. The authors suggest using cryptographic hashes and "bounty hunters" to verify outputs.
- Privacy: Since servers process intermediate data, they could theoretically attempt to reconstruct the original input. Users with highly sensitive data are encouraged to run private Petals swarms.
- Incentives: Future work involves implementing an incentive system to encourage users to provide GPU resources rather than just consuming them.
Summary updated