Deployment
The image
LayerScale ships as one Docker image on Docker Hub:
layerscale/layerscale:latestlayerscale/layerscale:latest-cuda
The two tags are the same image: the engine, the optional NVIDIA Dynamo worker, and the CUDA runtime libraries they link against. Both are multi-arch: an x86-64 host (x86-64-v3, with AVX2) and an NVIDIA Grace host (GH200, GB200, GB300) each pull their own build of the same engine.
The image exposes port 8080, reads a Pro license key from LAYERSCALE_LICENSE_KEY (or --license-key), and runs serve 0.0.0.0:8080 --model /models unless given other arguments. Given a Hugging Face repo id as --model, the engine downloads it into /root/.cache/huggingface inside the container; mount that path from the host so the download is kept, and pass -e HF_TOKEN=hf_... for a gated model. See Models.
GPU requirements
LayerScale supports datacenter Hopper, datacenter Blackwell and Vera Rubin cards. Hopper is the floor: the kernels rely on its shared memory size and asynchronous barriers, so earlier generations (Ampere, Ada and older) are not supported and fail with CUDA’s no kernel image is available for execution on the device. Consumer Blackwell is not supported yet: the engine refuses it at startup with a message that says so.
Datacenter Blackwell is supported at compute capability 10.0 (B200, GB200) and 10.3 (B300, GB300) on both host arches. The tcgen05_images startup line names the kernel image the card runs (sm_100a or sm_103a).
For NVIDIA GPUs the host needs a driver that supports CUDA 13.5, and Docker with the NVIDIA Container Toolkit so --gpus all works. Nothing else is needed on the host.
The host CPU must be x86-64-v3 on x86-64 (AVX2, FMA and BMI2: Intel Haswell, AMD Zen or newer), or an Arm Neoverse V2 core on arm64 (NVIDIA Grace: GH200, GB200, GB300). The image’s binaries are built for these baselines and stop with an illegal instruction on an older CPU.
Running
docker run -d --name layerscale --gpus all -p 8080:8080 \ -e LAYERSCALE_API_KEY=KEY \ -v ~/.cache/huggingface:/root/.cache/huggingface \ layerscale/layerscale:latest \ serve 0.0.0.0:8080 --model nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-NVFP4Pass engine flags after the image name; see Configuration. To require a key from clients, set LAYERSCALE_API_KEY (or pass --api-key KEY, which shows in the process list). KEY is a secret of your choosing, not the license key, and clients send it as a bearer token. Without it the API is open to anyone who can reach the port. The engine binds only after the weights are loaded and the warm-up has run, so a port that refuses connections for a while after start is expected. Watch docker logs -f layerscale for the ready line.
Multi-GPU
--tp N splits the model across GPUs 0 to N-1. Without it the engine uses every GPU visible in the container, so restrict either with --gpus '"device=0,1"' or with --tp. Tensor parallelism needs a Pro license key: on a multi-GPU host without one, pass --tp 1 or the engine refuses to start.
# 119 GB of fp8 weights across two 80 GB cards.docker run -d --gpus all -p 8080:8080 -e LAYERSCALE_LICENSE_KEY=LSK-... -e LAYERSCALE_API_KEY=KEY \ -v ~/.cache/huggingface:/root/.cache/huggingface \ layerscale/layerscale:latest \ serve 0.0.0.0:8080 --model mistralai/Mistral-Small-4-119B-2603 --tp 2The GPUs must be able to read each other’s memory (NVLink or PCIe peer access), and the model’s heads, KV heads, intermediate size and vocabulary must divide by N.
Multi-node
One copy of a model can also span several machines. See Multi-node.
Memory
The engine budgets --gpu-memory-utilization (default 0.92) of each card’s total memory for weights plus KV cache, and sizes the KV pool from what is left after the weights. Lower it when other processes share the card. --max-total-tokens pins the pool to an exact token count instead. --ctx bounds each sequence.
Health and readiness
GET /health (or /healthz) needs no key. It answers 200 with "status": "ok" while the engine thread is stepping or idle, and 503 with "status": "unavailable" if the engine has stopped or stalled. Use it for both liveness and readiness probes; before the engine is ready the port is not open at all. A fault the engine cannot recover from (a GPU that lost its CUDA context to a kernel fault, or at --tp above 1 a GPU that never arrives at a step) fails the requests in flight, turns /health to 503, closes the port a moment later and ends the process with a non-zero exit status within about a second, so run it under a supervisor that restarts it (restart: unless-stopped, a Kubernetes Deployment).
readinessProbe: httpGet: path: /health port: 8080 periodSeconds: 5livenessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 600 periodSeconds: 15Set the liveness delay to cover the model’s load and warm-up time.
Metrics
GET /metrics returns Prometheus text. Under --api-key it requires the key, so give the scraper a bearer token:
scrape_configs: - job_name: layerscale authorization: type: Bearer credentials: KEY static_configs: - targets: ["layerscale:8080"]The metric names are listed in the API reference.
Logs
Every line on stdout is one JSON object with ts, level and event. There is a request line per API call with route, status, token counts, time to first token and total time, so a log pipeline can build latency dashboards without scraping anything else.
Shutdown
SIGTERM or SIGINT stops accepting connections, lets in-flight requests finish for up to 30 seconds, tells the engine to stop, frees the GPU and exits (engine_freed in the log says how long freeing it took). docker stop sends SIGTERM; give it a stop timeout of at least 30 seconds.
Behind a reverse proxy
--api-keyis the only authentication, and it is off by default. Put the server behind TLS before exposing it, and do not bindserveto a public interface without a proxy in front.- Streaming responses are Server-Sent Events. Turn off response buffering for the
/v1/paths (proxy_buffering offin nginx) or tokens arrive in bursts. - Long generations exceed default upstream timeouts. Raise the proxy’s read timeout well past the longest expected response; the session event stream stays open indefinitely and sends a heartbeat every 15 seconds.
/v1/sessions/{id}/wsneeds theUpgradeandConnectionheaders forwarded.- The engine expects a request to arrive in full within 60 seconds and accepts bodies up to 1088 MiB; align the proxy’s limits.
- Health checks from the proxy or an orchestrator can hit
/healthwithout a key. Everything else forwards the client’sAuthorizationheader unchanged.
An nginx location that covers all of the above:
location / { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_buffering off; proxy_read_timeout 3600s; client_max_body_size 1088m;}$connection_upgrade is the usual map $http_upgrade $connection_upgrade { default upgrade; '' close; } in the http block.
Behind NVIDIA Dynamo
To serve from many workers behind NVIDIA Dynamo’s frontend and KV-aware router, with prefill and decode on separate GPUs if wanted, start the same image with dynamo as its first argument (docker run ... layerscale/layerscale:latest dynamo --model /models/...). It then runs as a Dynamo worker instead of serving its own API. See NVIDIA Dynamo for the worker’s flags, discovery, the frontend and Kubernetes.