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

Release GitHub license PyPI - Downloads

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+. For GPU support, install the appropriate PyTorch version for your CUDA configuration:
https://pytorch.org/get-started/locally/

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 currently supports a few model families including Qwen3, Phi, Meta Llama 3.1/3.2, and Gemma 3. View all tested models here

Planned Improvements

  • Additional model architectures
  • INT8 and INT4 quantization (currently all inference uses fp16)
  • GGUF format support (currently requires safetensors)

Dependencies

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.0.0.tar.gz (189.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.0.0-py3-none-any.whl (162.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: language_pipes-2.0.0.tar.gz
  • Upload date:
  • Size: 189.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.0.0.tar.gz
Algorithm Hash digest
SHA256 de96a37bc176e3b017b264b1b484fc45ef469a5f0fb9f561eb50eb256f956fb6
MD5 c9af71e6925222cc662a525b3df3b365
BLAKE2b-256 ce4015f4dce2b1cdcd4ae283193ea3cffd28a4ae6390a117934eb5c62fa4fb00

See more details on using hashes here.

Provenance

The following attestation bundles were made for language_pipes-2.0.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.0.0-py3-none-any.whl.

File metadata

  • Download URL: language_pipes-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 162.4 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4188fb9430fc031673a1de07d74470300ba1828d3bb4a03e0282f0e7ae93c501
MD5 af1a16fc026f8ecc2e1b81d2e94455db
BLAKE2b-256 3fdf93b71c8972ad3dc5cab62c77687ee38b2af9a0d04e6f82c10d955a473fad

See more details on using hashes here.

Provenance

The following attestation bundles were made for language_pipes-2.0.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