Petals is a distributed platform that runs large language models in a BitTorrent style, with the goal of running LLMs on home devices. Its core idea is: users load a small part of the model and then join a network where multiple people jointly serve other parts, thereby collaboratively completing fine-tuning and inference.
Main capabilities
- Models that support text generation include: Llama 3.1 (up to 405B), Mixtral (8x22B), Falcon (40B+), and BLOOM (176B), and support fine-tuning for users' own tasks.
- Fine-tuning and inference are up to 10 times faster than offloading.
- Single-batch inference performance: Llama 2 (70B) up to 6 tokens per second, Falcon (180B) up to 4 tokens per second, enough to support chatbots and interactive applications.
- Users can use any fine-tuning and sampling methods, execute custom model paths, or inspect hidden states; it combines the convenience of an API with the flexibility of PyTorch and Hugging Face Transformers.
How to use
- You can try it on a desktop computer or in Google Colab, and the official Colab entry point is provided.
- If running Llama, you first need to apply for access to its weights, then run huggingface-cli login in the terminal before loading the model, or directly use its chatbot application.
- Connecting your own GPU can increase Petals capacity: you can help serve existing models, or host new models from the Hugging Face Model Hub. The official example of hosting part of Llama 3.1 (405B) Instruct is provided.
- For hosting environments, the official options include: commands for NVIDIA GPUs under Linux + Anaconda (separate guidance for AMD); a Wiki guide for Windows + WSL; a Docker image for NVIDIA GPUs (separate guidance for AMD); for macOS + Apple M1/M2 GPU, Homebrew must be installed first and then the corresponding command executed. For more content (such as multi-GPU usage, starting the server on boot, etc.), see the official documentation.
- When participating in hosting, after loading and hosting more than 10 blocks, you can specify a name via --public_name YOUR_NAMEor link, displayed on the swarm monitor.
Use cases
- Run and fine-tune ultra-large language models on a personal computer or Colab.
- Build chatbots and interactive applications (the official chatbot web application source code is provided, connecting to Petals via HTTP/WebSocket endpoints).
- Conduct experiments such as prompt tuning, for example text semantic classification with Llama-65B, and a persona-based chatbot with BLOOM.
- Research and development that requires inspecting model hidden states or custom execution paths.
- View public network status through the public swarm monitor.
Limitations and notes
- Privacy: data will be processed with the help of other people in the public swarm; for sensitive data, a private swarm can be established among a group of trusted people.
- Security: hosting servers do not allow others to run custom code on your computer.
- Running Llama requires first obtaining access to its weights.
- The performance data are the officially stated single-batch inference speeds, and actual performance may vary depending on the environment.
Other information
- The official resources include basic tutorials (getting started, prompt tuning Llama-65B for text semantic classification, prompt tuning BLOOM to create a persona-based chatbot), chatbot web application source code, public swarm monitor source code, and advanced guides for private swarms and running custom models.
- Related papers were published at ACL 2023 (system demonstration) and NeurIPS 2023, and the project is part of the BigScience research workshop.