Skip to main content

The Narwhal logo, a black narwhal with a teal spiral tusk above the wordmark

Apache-2.0 license Python 3.11 through 3.13 Lint and format by ruff Types checked with mypy Latest PyPI version

Documentation Deployment API reference Issues Contributing

What is Narwhal?

Narwhal is a disaggregated inference framework that automatically hot-swaps prefill and decode roles as demand changes, without reloading model weights. It runs on a single GPU or across multi-node deployments.

Capability Behavior Guide
Role hot-swap Reassigns prefill and decode roles across a fixed GPU fleet, with NIXL key-value (KV) transfer between them Core concepts documentation
Serving Serves completion and chat requests, streamed or buffered, with latency-aware admission HTTP API reference documentation
Fault tolerance Fails over to a warm-standby router and readmits engines against their live process generation Operating Narwhal documentation
Measurement Profiles engines, runs ordered benchmark points, and keeps the evidence from each point Measuring a fleet documentation
Observability Exports router and engine metrics to Prometheus and a provisioned Grafana dashboard Setting up observability documentation
Operator tooling Validates fleet files offline and collects private diagnostic bundles CLI reference documentation
Development mode Runs two to eight engines on one NVIDIA CUDA GPU under Ubuntu or WSL2 Narwhal dev documentation

How engines change roles

The role controller scores the current role split and each adjacent split, one engine move away. It uses measured engine profiles, offered demand, and resident work, and moves one engine only when the worst projected SLO ratio improves and every role, lifecycle, and resident-work guard passes. New requests follow the revised split, and resident requests finish on their assigned engines.

Role control and capacity floors documentation

Role controller changing engine roles with weights resident.

Evaluation

Read the full evaluation: Evaluating Narwhal

Getting the commands

Install on Linux with Python 3.11 or newer:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install narwhal-inference
narwhal-serve --version
narwhal --help

The wheel installs narwhal, narwhal-engine, narwhal-serve, narwhal-attest, narwhal-profile, and narwhal-check. To verify the installation, follow Installing from PyPI. For each command's options, use the CLI reference.

Trying it on one GPU

Narwhal dev runs a local NVIDIA CUDA fleet on Ubuntu, either directly or under WSL2.

narwhal dev init
narwhal dev up
narwhal dev verify
narwhal dev status
narwhal dev down

The default template starts two vLLM engines and the SGLang template starts two SGLang engines, each on an NVIDIA GPU whose free VRAM is at least 80% of its total plus 512 MiB. The RTX 5090 reference template starts four vLLM engines on an RTX 5090.

Installed template documentation RTX 5090 reference documentation

Bringing up a fleet

Run the deployment gates in Deploying a fleet from a management workstation.

Documentation

The documentation site covers installation, deployment, operation, measurement, and reference tasks.

Contributing

Contributing Code of conduct Security policy

Built on Arrow

Narwhal's scheduling algorithms are based on Arrow: Adaptive Scheduling Mechanisms for Disaggregated LLM Inference Architecture by Wu et al. (2025).

Arrow paper on arXiv Citation metadata for Arrow and Narwhal Apache-2.0 license

Changelog

0.8.0 (2026-10-20)

Features

  • operator visibility and setup (#384) (3261c0d)
  • reuse still-valid calibrations and profiles (#373) (0181298)
  • take prefill capacity back on load surges and fix decode pressure and seat placement (#364) (d4ee7b0)

Fixes

  • ship characterization golden records in the sdist (#371) (5a0ae2e)
  • ship docs walkthroughs in the sdist and widen stage test budgets (#369) (4c08716)

0.7.0 (2026-10-12)

Features

  • SGLang engine backend and engine-neutral backend interfaces (#336) (c7ccf28)

Documentation

  • fit fleet walkthrough to viewport (#330) (0457952)
  • replace dashboard screenshots with a walkthrough (#333) (055f547)
  • trim duplicated documentation (#325) (cdeadb8)

0.6.0 (2026-10-10)

Features

  • fleet control service (#301) (f1f1164)
  • qualified admission, queueing and retries (#312) (05df12f)
  • redesign the fleet control console as a standalone page linked from Grafana (#313) (4d7be2e)

Documentation

0.5.0 (2026-10-05)

⚠ BREAKING CHANGES

  • engine-role environments drop NARWHAL_ENGINE_LAUNCHER and NARWHAL_ENGINE_LAUNCHER_SHA256; run engine actions with narwhal-engine. The attestation contract tool runs as python -m narwhal.deployment.attestation_contract.cli.

  • concurrent first-token calibration with measured and reused reporting (#242)

  • split oversized modules by concern (#252) (e29cadc), closes #239

Features

  • colour dashboard series by meaning (#270) (9212382)
  • concurrent first-token calibration with measured and reused reporting (#242) (683b83b)
  • enhance reactive policy to manage unsettled evaluations and departure leads (#251) (4712899)
  • faster role changes and slot-aware decode admission (#234) (55f7854)
  • make AIPerf 0.13.0 the documented benchmark client (#280) (cadcc87), closes #271
  • router data-plane throughput (#267) (1be680b)

Fixes

  • check idle engine connections with poll() (#281) (714adb7)
  • keep a departure leading through one evaluation below the margin (#250) (551fa2f)
  • pin Narwhal dev to vLLM 0.30.0 (#269) (25f5383)
  • use one red across the dashboard (#279) (37b5f5b)

Documentation

  • document resetting engine prefix caches (#283) (01cc58d)

0.4.1 (2026-10-02)

Features

  • give dashboard series one colour palette (#235) (c160ad5)

0.4.0 (2026-10-01)

Features

0.3.2 (2026-09-30)

Documentation

  • add Google Search Console verification file (#225) (ded08a8)
  • define milestone delivery and deployment privacy rules (#202) (6255337)
  • Refresh (#223) (f71a178)
  • refresh README introduction and link benchmark write-up (#217) (c10c3ae)
  • split Narwhal dev guide into numbered pages (#222) (5f2d3fa)
  • tighten contributor and issue-form prose (#210) (8d85ed8)

0.3.1 (2026-09-27)

Fixes

  • calibrate and enforce fleet timeout budgets (#158) (0629f01)
  • enforce generation-bound engine readmission and document lifecycle drills (#161) (03d3ac1)

Documentation

  • agent: define operator contract and plugin boundaries (#140) (b142e6a)
  • clarify cancellation in deployment attainment (#139) (2215401)
  • remove repeated guidance and clarify benchmark scope (27b573c)

0.3.0 (2026-09-25)

Features

  • add four-engine WSL2 development mode (8c5b980)
  • cli: add offline inspection, diagnostics and bounded lifecycle (9df3904), closes #122 #123 #124 #125 #126
  • docs: add selectable dark mode (1c87cae)
  • link Grafana icon to Narwhal repository (ea1d6df)
  • reproducible benchmark runs (#55) (671bf35)

Fixes

  • bind profiles to live engine generations (4ea5be0)
  • ci: remove release build pip cache (#77) (28fe2e0)
  • ci: validate release SHA before candidate checkout (1976ef8)
  • cli: enforce launch checks and consistent command output (49133c9)
  • include documentation commits in releases (d6e84bc)
  • serving: hide upstream exception details from clients (#75) (15482c8)

Documentation

  • clarify runbooks and align validation guidance (#104) (9cfe74b)
  • document issue labels and fix bug template (d8c37a5)
  • hide page edit action (04ed085)
  • refresh README installation and references (1612192)
  • remove obsolete CPU tooling references (#52) (b836a91)
  • simplify fleet deployment runbook (#92) (bd93aaf)

0.2.1 (2026-09-23)

Features

  • publish Narwhal distributions to PyPI (a328d00)

0.2.0 (2026-09-23)

Features

  • make first fleet deployment reproducible (14f27f0)

Fixes

  • ci: give deployment bundle tests Git history (33c2f9f)

0.1.0 (2026-09-20)

Narwhal's initial public release routes LLM inference across prefill and decode engines and changes their roles while model weights remain loaded.

Serving and admission

  • OpenAI-compatible completion and chat endpoints with streaming, input validation, and vLLM engine support.
  • Profile-based request placement with predictive admission and bounded queueing.
  • Optional transient retries restart the complete prefill/decode attempt before visible output. One deadline and a shared retry budget bound every original request.
  • Deployment-owned engine credentials authenticate serving, profiling, preflight and lifecycle probes.
  • Client cancellation releases capacity and bypasses the engine-failure counters. First-token deadlines remain active through metadata-only stream frames.
  • Engine health monitoring, quarantine, ejection, and recovery of the configured prefill and decode floors.

Fleet control

  • One reactive controller moves engines between prefill and decode roles. Each decision scores the current split and its adjacent alternatives. Role pinning and minimum pool sizes constrain those changes.
  • Decode capacity estimates account for active sequences and resident KV tokens. Profile coverage, demand evidence, resident work, and consolidation safety constrain role changes.
  • Warm-standby control-plane handoff preserves router state across takeover.

Deployment and validation

  • Generic vLLM/NIXL kv_both fleet support binds one model, hardware shape and KV layout through fleet configuration, engine attestations and measured profiles. Operators own image selection and process launch.
  • Kubernetes, Ansible, Terraform or site automation provisions hosts, distributes artifacts, configures routes and launches engines; Narwhal validates the running engine and KV-transfer contracts.
  • Preflight checks cover engine health, process-bound compatibility, generation, profiles, SLOs, and the transfer fabric.
  • Fleet schema 1 groups controller, serving, engine I/O, recovery and profile policy under their runtime owners. Ingress owns client identity and content capture; Narwhal owns one global admission budget and retains timings, identifiers, placements and outcomes.
  • Profile and configuration validation reject invalid types, non-finite values, incomplete measured domains, and mismatched engine sets.
  • Deployments record source identity and file digests.

Measurement and operations

  • Profiling measures per-engine prefill and decode curves; correctness canaries track exact output across live controller events.
  • Per-request journals, controller state, Prometheus metrics, a Grafana dashboard, and engine-down alerts. One startup command derives router and engine scrape targets from the deployed fleet, then verifies target health and populated dashboard queries.

Deployment qualification

  • Collect per-engine profiles, live runtime evidence, exact-output canaries and deployment load results before serving client traffic.
  • Validate prefix caching and speculative decoding against the selected model, engine build and KV layout before enabling them. Prefix caching requires exact-replay and continuation checks. Use whole-wave restart policy when the engine build shares peer registrations across the fleet.

See the configuration reference for defaults and the measurement guide for deployment requirements.

Metadata

Release files for narwhal-inference 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for narwhal-inference 0.8.0
File Size Uploaded Provenance Actions
narwhal_inference-0.8.0.tar.gz 4.4 MB With provenance Details for narwhal_inference-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for narwhal-inference 0.8.0
File Interpreter ABI Platform Actions
narwhal_inference-0.8.0-py3-none-any.whl Python 3 none any Details for narwhal_inference-0.8.0-py3-none-any.whl

Total release size: 4.8 MB

Release files / narwhal_inference-0.8.0.tar.gz

Download URL narwhal_inference-0.8.0.tar.gz
Size 4.4 MB
Tags Source
SHA-256 checksum
How to use checksums
5781dbcb3fc35470743d730417ec08c607637d5d2f3bd1f380f1bfc197f635b5
BLAKE2b-256 checksum
How to use checksums
765b5919db1d28262b00f77d880820c761d994dc44f531674ad3699873bfab50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Release files / narwhal_inference-0.8.0-py3-none-any.whl

Download URL narwhal_inference-0.8.0-py3-none-any.whl
Size 438.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55f5f25c56e170fc5f167b0b4f621ce65a074d578f13351c25acc1fa7cb97f3f
BLAKE2b-256 checksum
How to use checksums
dd74b921da7d6db0eff8bb4bbe03dea0375a61a54fb14b5a5ad1b1e0d0ed6b3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Security for narwhal-inference 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for narwhal_inference-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page