LLM serving teams
Cut time-to-first-token without re-architecting inference.
Run Membrane next to vLLM, SGLang, or TensorRT-LLM through the bundled adapters. Shared system prompts and documents come back from cache instead of being prefilled again.
Membrane stores prefill results once and serves them to every node in your fleet. Repeated prompts skip prefill, time-to-first-token drops, and GPUs stop recomputing the same context.
# 1. A prompt is prefilled once, anywhere in the fleet $ curl -s :8080/prefill -d '{"prompt_tokens": [0, …, 299], "model_id": "llama-3-8b"}' → 3 fragments stored tokens 0–127 · 128–255 · 256–299 # 2. The same context, on any node, comes back from cache $ curl -s :8080/reconstruct -d '{"tokens": [0, …, 299], "model_id": "llama-3-8b"}' { "coverage": 1.0, "prefilled": false, "fragments": [ "1fbfae53…", "ad9a27a8…", "8668eeed…" ] }
How it works
Most serving fleets recompute the same system prompts, documents, and chat histories on every node. Membrane turns that work into a shared, addressable cache.
A node runs prefill and cuts the KV-cache into token windows. Each window becomes a fragment addressed by its hash: model, layers, heads, tokens, dtype, and bytes.
Fragments are placed on a consistent-hash ring and replicated with their bytes. Gossip tells every node where they live; identical content is stored once.
When a prompt arrives, Membrane rebuilds its context from cached fragments and prefills only the gaps. Full coverage means no prefill at all.
Features
Storage, lookup, routing, and cluster primitives, with the security and operations work already done.
KV segments keyed by a ten-field identity hash. Identical content is stored once; each tenant keeps its own copy of the metadata.
Exact, semantic, positional, and co-access indices over the same fragments, behind a single Index API.
Rebuilds a context from cached fragments and prefills only the uncovered spans, never the whole prompt.
Economic, latency, and joint routers send each request to the node that already holds its context.
Consistent-hash ring, gossip membership, failure detection, byte-verified replication, and quorum writes.
API keys or mTLS on every route, per-tenant reads, AES-256-GCM at rest, and a tamper-evident audit log.
Adapters for vLLM, SGLang, and TensorRT-LLM; backends for Transformers, OpenAI, Anthropic, and Ollama.
Prometheus metrics, OpenTelemetry traces, a live dashboard, and admin commands to inspect and repair.
Architecture
The same Python runtime runs as a single node or a gossip-meshed fleet: same code, same semantics, same wire format. Compute, storage, persistence, eviction, placement, auth, and secrets are plugins you can replace without forking.
Read the architecturePerformance
Measured numbers come from this repository's benchmarks and CI jobs. The modeled numbers reproduce the Prefill-as-a-Service paper's case study, and are labelled as such.
scripts/demo.pyEqs. (1)–(6) of the paper with a piecewise-linear Table-5 fit, run on its Section 4 workload. A model, not a benchmark of a live cluster. Source
Developer experience
Every snippet here is copied from the quickstart and runs in CI.
membrane command.git clone https://github.com/sachncs/membrane.git
cd membrane
uv sync --frozen --extra server # Python 3.14 + locked deps
source .venv/bin/activateBuilt for
LLM serving teams
Run Membrane next to vLLM, SGLang, or TensorRT-LLM through the bundled adapters. Shared system prompts and documents come back from cache instead of being prefilled again.
Multi-tenant platforms
Every tenant keeps its own copy of a fragment and can only read its own. A cross-tenant read is indistinguishable from a miss, and identical bytes are still stored once.
Research and infrastructure
The analytical throughput model, a Table-5 fit, and an end-to-end simulator. Reproduce, stress, and extend Prefill-as-a-Service on real code.
Python 3.14, locked dependencies, no account. The quickstart takes you from clone to a cache hit.
git clone https://github.com/sachncs/membrane.git cd membrane uv sync --frozen --extra server # Python 3.14 + locked deps source .venv/bin/activate