Skip to content
Back to skills

Petals

ASecurity

"Use Petals for distributed large-language-model inference, prompt

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 8, 2026
ai-agentspythonbashapibackendperformance

Works with

  • cli
  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 20 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill petals --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Petals?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Petals
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-petals/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-petals)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: petals
description: "Use Petals for distributed large-language-model inference, prompt
  tuning, server swarms, block-level internals, benchmarks, and package
  troubleshooting."
disable-model-invocation: true
metadata:
  disco-role: operating
license: MIT
---

# Petals Repo Skill

Use this skill when a task involves Petals, the Python package for collaborative distributed inference and prompt tuning of large language models whose transformer blocks are hosted by remote peers.

This skill is self-contained. Do not rely on a repository checkout being present unless the user explicitly says they are maintaining one; use the bundled references and scripts below for ordinary package workflows.

## Start here

1. For install, import, dependency, cache, model-access, and backend readiness, read [references/installation-and-environment.md](references/installation-and-environment.md).
2. Run the safe root checker when you need a no-network local sanity check:

   ```bash
   python scripts/check_petals_environment.py --pretty
   ```

   A passing checker means local imports, API discovery, and CLI parser checks worked. It does not prove public swarm health, model access, GPU serving performance, or adapter execution.
3. Route the user request to the nearest sub-skill below.
4. For cross-cutting failures, read [references/troubleshooting.md](references/troubleshooting.md).
5. Before refreshing this skill against a newer Petals release, read [references/repo-provenance.md](references/repo-provenance.md).

## Sub-skill routing

| User intent | Read this |
| --- | --- |
| Write client code for distributed generation, sequence classification, public/private swarm clients, `AutoDistributedModel*`, `.generate()`, `inference_session`, routing or retry options | [sub-skills/client-inference/SKILL.md](sub-skills/client-inference/SKILL.md) |
| Host model blocks, start a server, bootstrap a private DHT, construct `python -m petals.cli.run_server` / `run_dht` commands, reason about ports, identities, cache, device, dtype, quantization, adapters, or reachability | [sub-skills/server-swarms/SKILL.md](sub-skills/server-swarms/SKILL.md) |
| Adapt a distributed model with `tuning_mode="ptune"` or `"deep_ptune"`, train prompt embeddings/classifier heads, plan causal-LM or classification prompt tuning, or troubleshoot PEFT adapter safety | [sub-skills/prompt-tuning/SKILL.md](sub-skills/prompt-tuning/SKILL.md) |
| Work with `RemoteSequential`, block slices, hidden-state tensors, `load_pretrained_block`, `QuantType`, tensor parallel conversion, speculative Llama internals, dtype resolution, or block-level errors | [sub-skills/distributed-blocks/SKILL.md](sub-skills/distributed-blocks/SKILL.md) |
| Build benchmark command templates, plan tiny smoke checks, select focused native maintainer checks, or interpret benchmark/CI health signals | [sub-skills/benchmarks-maintenance/SKILL.md](sub-skills/benchmarks-maintenance/SKILL.md) |

## Core operating model

- Petals model classes are Transformers-compatible wrappers. Embeddings and heads live on the client; transformer blocks are discovered through a Hivemind DHT and executed by remote Petals servers.
- The default public swarm is external: availability, hosted block coverage, peer latency, and gated model access can change independently of local package health.
- Private swarms require consistent `initial_peers`, `dht_prefix`, model identifier, and block ranges across clients and servers.
- Generation needs a remote attention-cache budget. Without an active session, pass exactly one of `max_new_tokens` or `max_length`; for interactive continuation, explicitly create and reuse `inference_session(max_length=...)`.
- Prompt tuning trains local prompt embeddings and, for classification models, local heads. The client does not update remote transformer blocks hosted by servers.
- Server-side quantization and adapters are optional backend features. Verify the actual torch/CUDA/ROCm/MPS/bitsandbytes stack before claiming they work.

## Install and minimal import

```bash
python -m pip install petals
python - <<'PY'
import petals
from petals import AutoDistributedModelForCausalLM
print(petals.__version__)
PY
```

For a checkout maintained by the user, use that checkout's package metadata to choose the Python version and dependencies, then run the same import check from outside the checkout directory. Do not treat import success as proof that a public swarm, gated model, GPU serving, or adapter loading is available.

Files in this skill

  • SKILL.md4.4 KB
  • references/installation-and-environment.md3.5 KB
  • references/repo-provenance.md1.7 KB
  • references/repo-routing-metadata.json544 B
  • references/troubleshooting.md3.3 KB
  • scripts/check_petals_environment.py5.9 KB
  • sub-skills/benchmarks-maintenance/SKILL.md1.3 KB
  • sub-skills/benchmarks-maintenance/references/benchmarking.md1.5 KB
  • sub-skills/benchmarks-maintenance/references/native-smoke-tests.md1.6 KB
  • sub-skills/benchmarks-maintenance/references/troubleshooting.md1 KB
  • sub-skills/benchmarks-maintenance/scripts/build_benchmark_command.py3.3 KB
  • sub-skills/benchmarks-maintenance/scripts/run_petals_benchmark.py7.9 KB
  • sub-skills/client-inference/SKILL.md1.8 KB
  • sub-skills/client-inference/references/api-reference.md2.5 KB
  • sub-skills/client-inference/references/troubleshooting.md1.3 KB
  • sub-skills/client-inference/references/workflows.md2.2 KB
  • sub-skills/client-inference/scripts/client_smoke_check.py2.2 KB
  • sub-skills/distributed-blocks/SKILL.md1.3 KB
  • sub-skills/distributed-blocks/references/api-reference.md1.3 KB
  • sub-skills/distributed-blocks/references/troubleshooting.md1012 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.