Skip to main content

Peer-to-peer distributed inference for open-source language models

Project description

 _                                                   ____   _
| |                                                 |  __`\(_)                
| |     __ _  ___   ___  _   _  __ _  __ _  ___     | |__) | |_ __   ___  ___ 
| |    / _` |/ _ \ / _ `| | | |/ _` |/ _` |/ _ \    |  ___/| | '_ \ / _ \/ __|
| |___| (_| | | | | (_| | |_| | (_| | (_| |  __/    | |    | | |_) |  __/\__ \
|______\__,_|_| |_|\__, |\__,_|\__,_|\__, |\___|    |_|    |_| .__/ \___||___/
                    __/ |            __/ |                   | |              
                   |___/            |___/                    |_|      

Peer-to-peer distributed inference for open-source language models

Tests Release GitHub license PyPI - Downloads

Documentation & site: https://languagepipes.com

Language Pipes is an open-source distributed inference system built on the transformers library that splits large language model computation across multiple machines. By separating the model's text-handling components (embedding and output head) from its intermediate transformer layers, Language Pipes enables peer-to-peer inference.

Features

  • OpenAI-compatible API
  • Automatic model download by HuggingFace ID
  • Interactive TUI for configuration, monitoring, and control
  • Decentralized peer-to-peer network with optional AES encryption

How It Works

Language models process input through a sequence of transformer layers. Each layer performs matrix multiplications between learned weights and a hidden state tensor, passing the result to the next layer. Language Pipes distributes these layers across machines, splitting the memory cost across the network while keeping the text-handling components on the origin node.

The architecture provides architectural separation: layer models operate on continuous-valued tensors rather than discrete text while the end models keep text data on trusted systems. The privacy documentation provides a probabilistic threat model that quantifies the difficulty of known inversion attacks under various mitigation configurations.

Further reading:

Installation

Requires Python 3.10+. A GPU is optional — each node can run on CPU or CUDA, and a node only needs enough memory to hold the layers it hosts (memory scales with how many layers you assign it). For GPU support, install the appropriate PyTorch version for your CUDA configuration:
https://pytorch.org/get-started/locally/

See System requirements and network requirements for details, including what happens when a node drops mid-generation.

Install from pip:

pip install language-pipes

Quick Start

Launch the interactive TUI:

language-pipes

From the main menu, select New Configuration and give it a name to create a TOML config and open the dashboard (or Load Configuration to reopen one you've created before).

The dashboard is organized into tabs along the top: Home, Network, Models, Pipes, and Jobs. A fresh configuration has no node ID yet, so the only option on Home is Configure Network Server. Set a Node ID under Network > Configure, then return to Home and select Start Network Server. Once the network is running, the dashboard exposes the rest of setup: load models under Models > Layer Models / End Models, and configure and start the OpenAI-compatible API under Jobs > Server.

Configuration can also be edited directly as TOML files and run headlessly. See the CLI reference for details on running a saved configuration from the command line.


Two Node Example

This example distributes Qwen/Qwen3-1.7B across two computers. Node 1 hosts the End Model, so prompts and responses stay on Node 1, plus enough layers to fit in its memory. Node 2 hosts the remaining layers.

Node 1 (First Computer)

language-pipes

Select New Configuration and name it (e.g. node-1).

  1. Network > Configure: set Node ID to node-1 and ensure Network IP is set to this machine's local IP address. Leave Network Key empty to disable encryption for this example. Peer Port defaults to 5000.
  2. Back on Home, select Start Network Server.
  3. Models > Installed: select Install New Model and enter Qwen/Qwen3-1.7B to download it.
  4. Models > Layer Models: select Add Layer Model, choose Qwen/Qwen3-1.7B, a device (cpu or cuda:0), and a memory budget in GB (e.g. 2), then Save Model. Confirm to load it now.
  5. Models > End Models: select Add End Model, choose Qwen/Qwen3-1.7B, and confirm to load it now.
  6. Jobs > Server: ensure the Port is set to 8000 and select Start Server.

Node 2 (Second Computer)

language-pipes

Select New Configuration and name it (e.g. node-2).

  1. Network > Configure: set Node ID to node-2. Under Bootstrap Nodes, add an entry with node-1's IP address and peer port (5000) so this node joins node-1's network.
  2. Back on Home, select Start Network Server.
  3. Models > Installed: install Qwen/Qwen3-1.7B as on Node 1.
  4. Models > Layer Models: add Qwen/Qwen3-1.7B with a device and memory budget covering the remaining layers (e.g. 2 on cpu).

Once both nodes have loaded their layers, Pipes > Complete shows a completed pipe for Qwen/Qwen3-1.7B, and the model is ready for inference via node-1's Job Port.

Test the API

The model is accessible via the OpenAI-compatible API.

Example using the OpenAI Python library:

from openai import OpenAI

client = OpenAI(
    base_url="http://127.0.0.1:8000/v1",  # node-1 IP address and Job Port
    api_key="not-needed"  # only required if api_keys is set in the config
)

response = client.chat.completions.create(
    model="Qwen/Qwen3-1.7B",
    max_completion_tokens=100,
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Write a haiku about distributed systems."}
    ]
)

print(response.choices[0].message.content)

Install the OpenAI library with: pip install openai

See the OpenAI-compatible API documentation for the full endpoint reference and sampling parameter descriptions.

Supported Models

Language Pipes supports Qwen3 (dense and MoE), Phi, Meta Llama 2/3, Gemma 3, Gemma 4, and Ministral 3. See the supported-models list for a more complete list.

Roadmap

  • Additional model architectures
  • 4 bit quantization
  • KV Cache quantization
  • GGUF format support (currently requires safetensors)
  • Failover/rerouting when a layer node drops, and integrity guarantees for layer computation

See the full roadmap for details and open research directions.

Contributing

Contributions are welcome! Bug reports, documentation fixes, and especially new model architectures. See CONTRIBUTING.md for dev setup, how to run the tests, and PR expectations, and the Code of Conduct. Questions and ideas are welcome in GitHub Discussions.

Dependencies

Documentation

The docs are published as a website at https://erinclemmer.github.io/language-pipes (built from this folder by website/). The Markdown source of truth lives in documentation/:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

language_pipes-2.2.0.tar.gz (336.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

language_pipes-2.2.0-py3-none-any.whl (174.2 kB view details)

Uploaded Python 3

File details

Details for the file language_pipes-2.2.0.tar.gz.

File metadata

  • Download URL: language_pipes-2.2.0.tar.gz
  • Upload date:
  • Size: 336.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for language_pipes-2.2.0.tar.gz
Algorithm Hash digest
SHA256 d6f82eabdc334fe086ffebab63cf6d017aeb192d5d79ebafef9807151389af39
MD5 b56e976b1db6e2f457d42fa0d4c30e07
BLAKE2b-256 24086729c73b666046e0b1a1359490caf7fd7c5f2b5448e442360776507fc994

See more details on using hashes here.

Provenance

The following attestation bundles were made for language_pipes-2.2.0.tar.gz:

Publisher: publish.yml on erinclemmer/language-pipes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file language_pipes-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: language_pipes-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 174.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for language_pipes-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d28927ef9085f9c26c22f1f256e1d1cdf12b4ad8a2f0a5b7c4714bc14f150ee2
MD5 c392e5a85ae5e50541ea9617a30b73bf
BLAKE2b-256 bbaa2c36d7aa4a83b7c0352312850eb86d0ccd5cda9e51873176a008b232b7b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for language_pipes-2.2.0-py3-none-any.whl:

Publisher: publish.yml on erinclemmer/language-pipes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page