_ ____ _
| | | __`\(_)
| | __ _ ___ ___ _ _ __ _ __ _ ___ | |__) | |_ __ ___ ___
| | / _` |/ _ \ / _ `| | | |/ _` |/ _` |/ _ \ | ___/| | '_ \ / _ \/ __|
| |___( (_| | | | | (_| | |_| | (_| | (_| | __/ | | | | |_) | __/\__ \
|______\__,_|_| |_|\__, |\__,_|\__,_|\__, |\___| |_| |_| .__/ \___||___/
__/ | __/ | | |
|___/ |___/ |_|pip install language-pipesThe idea
P2P inference for open-source LLMs
Language models run their input through a long stack of transformer layers. Language Pipes cuts that stack into segments and hands each segment to a different machine, so the memory cost is shared across a network you control. No single node needs to hold the whole model and no central server sits between your nodes. It's peer-to-peer, decentralized, and Python-native.
Why Language Pipes
Distributed · Decentralized · Standardized API
Distributed Inference
Transformer layers are split across multiple machines over a peer-to-peer control plane, so a model too large for any one box runs across the network.
Architecture →You host the text boundary
Only the node hosting the End model ever sees raw text, and you host it. Each node can run its own End model, so there is no central authority and no central configuration.
Configuration →OpenAI-compatible API
A drop-in base_url swap for existing OpenAI client code. Point your tools at a node and keep the SDK you already use.
How it works
Layer models and the End model
Inference flows through a pipeline. The End model keeps the text-handling stages (tokenization, embedding, final norm and the output head) on one trusted node. The transformer layers in between are distributed across Layer models on other machines, which only ever see continuous-valued hidden-state tensors.
Raw text never leaves the End model node, and layer nodes see only hidden-state tensors — but hidden states are not encryption. A determined layer operator who also has the open model weights may be able to invert them back toward your prompt. Run layer nodes on machines you trust.See the threat model →
Each layer performs matrix multiplications between learned weights and a hidden-state tensor, then passes the result down the pipe. Splitting where the layers are hosted shares the memory cost and keeps text off every node but the one making the request.
See the job processor state machine →
Understand the threat model →
Quick start
Two nodes, two config files
Distribute Qwen/Qwen3-1.7B across two machines. Write a TOML config for each node and run it headless — no clicking through the TUI. Node 1 hosts the End Model, so prompts and responses stay on Node 1, plus enough layers to fit its memory. Node 2 hosts the rest and joins Node 1's network.
# node-1.toml — hosts the End model, so text stays here
node_id = "node-1"
job_port = 8000 # OpenAI-compatible API
end_models = ["Qwen/Qwen3-1.7B"]
[[layer_models]]
model_id = "Qwen/Qwen3-1.7B"
device = "cpu"
memory = 2# node-2.toml — hosts the remaining layers only
node_id = "node-2"
[[layer_models]]
model_id = "Qwen/Qwen3-1.7B"
device = "cuda:0"
memory = 4
[[bootstrap_nodes]]
address = "192.168.0.1" # node-1's LAN IP
port = 5000Start each node from its config file:
# on machine 1
$ language-pipes -c node-1.toml run
# on machine 2
$ language-pipes -c node-2.toml runOnce both nodes have loaded their layers, call Node 1 like any OpenAI endpoint:
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:8000/v1", # node-1 IP + job port
api_key="not-needed",
)
resp = client.chat.completions.create(
model="Qwen/Qwen3-1.7B",
messages=[{"role": "user",
"content": "Write a haiku about distributed systems."}],
)
print(resp.choices[0].message.content)Prefer a guided setup? Run language-pipes with no arguments to configure each node in the interactive TUI instead.
Support
Supported models
Model families today
- Qwen3 & Qwen3-MoE
- Phi (Phi-4)
- Meta Llama 2 and 3
- Gemma 3 and 4
- Ministral 3
Fine-tunes of a supported base model should work too. Thesupported-models list is the authoritative, up-to-date reference.
Built on
Reusable standalone packages
Two building blocks of Language Pipes are published as their own MIT-licensed packages on PyPI, maintained from this repo. Use them on their own, or let Language Pipes pull them in. It pins exact versions of both, so a language-pipesupgrade always installs the matching releases.
llm-layer-collector
Load individual transformer components, embedding, decoder layers, norm and head, from sharded HuggingFace checkpoints and run per-architecture computation.
Documentation →distributed-state-network
The encrypted peer-to-peer state-sharing network over HTTP that Language Pipes uses as its default router. Signed packets, rolling AES, self-organizing peers.
Documentation →