Decouple cache from GPU
Treat KV-cache as a first-class, distributed resource. Memory is content-addressed; compute is pluggable. GPUs become stateless workers, not pinned caches.
Membrane separates the KV-cache from GPU memory and turns it into a distributed, content-addressed fabric — sharing prefill work across clusters, slashing time-to-first-token, and reclaiming GPU capacity at scale.
membrane serve --node-id n1 --port 8080 --transport http --peer n2:8081 --peer n3:8082
Reference implementation of Prefill-as-a-Service · production-grade, paper-faithful.
Membrane is the runtime that lets LLM serving fleets reuse prefill work across nodes, regions, and tenants — without re-engineering your inference stack.
Treat KV-cache as a first-class, distributed resource. Memory is content-addressed; compute is pluggable. GPUs become stateless workers, not pinned caches.
Reconstruct contexts from fragments held anywhere in the cluster. When coverage is incomplete, Membrane falls back to a single prefill — never a re-decode.
Built on the analytical throughput model from the paper. Economic, latency, and joint routers pick the best node from access history and live telemetry.
Production-grade primitives, a coherent runtime, and the operational surface to run them confidently at scale.
KV segments keyed by a ten-field PayloadIdentity hash. Two fragments with the same hash are byte-identical — instantly deduplicated across tenants and regions.
Exact, semantic, positional, and co-access indices over the same fragment set. Sub-millisecond lookups, exposed through a single Index class.
Walks the indices to rebuild a context. Falls back to a single prefill only when coverage is incomplete — never wasteful re-decoding.
Economic, latency, and joint routers pick the best node from access history and live telemetry. Backed by the paper's Eqs. (1)–(6).
Consistent-hash ring, gossip state exchange, heartbeat-driven failure detection, and background replication — all in-process.
Per-fragment payload encryption, deny-by-default mTLS, per-route scope checks, and a typed cluster error hierarchy.
CPU reference, GPU (PyTorch CUDA with CPU fallback), HuggingFace Transformers, plus native OpenAI, Anthropic, and Ollama adapters.
A Rich-powered live dashboard, an interactive setup wizard, and a complete admin surface (snapshot, restore, rotate-keys).
A coherent Python runtime that you can run as a single node or a gossip-meshed fleet — same code, same semantics, same wire format.
The analytical model in model/throughput_model.py
reproduces Eqs. (1)–(6) from the Prefill-as-a-Service paper with a
piecewise-linear Table-5 fit — verified end-to-end against the simulator.
A real Python SDK with strict types, a CLI that respects your time, and an OpenAPI surface you can drop into any client generator.
from membrane.server import Server
from membrane.compute import CPU
server = Server(
node_id=class="text-accent-mint">"n1",
host=class="text-accent-mint">"0.0.0.0",
port=8080,
transport=class="text-accent-mint">"http",
compute=CPU(),
peers=[class="text-accent-mint">"n2:8081", class="text-accent-mint">"n3:8082"],
replica_count=2,
)
server.run() Strict types throughout · mypy strict · Google-style docstrings · zero semi-private names.
Drop Membrane alongside vLLM, TGI, or any custom stack. Cache fragments at the cluster edge, reconstruct on the hot path, fall back to a single prefill when coverage is incomplete.
Content-addressed dedup plus per-tenant policies means one canonical store, with hard isolation. Tenants inherit the hit-rate without seeing each other's data.
Six analytical equations, a piecewise-linear Table-5 fit, and an end-to-end simulator. Reproduce, stress, and extend the Prefill-as-a-Service model.
pip install membrane
— and you have a single-node runtime in seconds. Add
--peer flags to grow into a cluster.
$ pip install membrane