Skip to main content

Overview

This page documents all available server arguments for launching SGLang. These can be passed via command-line flags or programmatically when creating an Engine.

Model and Tokenizer

string
required
Path to model weights. Can be a local folder or HuggingFace repo ID.Examples: meta-llama/Llama-3.1-8B-Instruct, /local/path/to/model
string
default:"null"
Path to tokenizer. Defaults to model-path if not specified.
string
default:"auto"
Tokenizer mode. Options: auto (use fast tokenizer if available), slow (always use slow tokenizer).
bool
default:"false"
Skip tokenizer initialization. When enabled, you must pass input_ids directly to generate.
string
default:"auto"
Model weight format to load.Options: auto, pt, safetensors, npcache, dummy, gguf, bitsandbytes, layered, remote
bool
default:"false"
Allow custom models from HuggingFace Hub with custom modeling files.
int
default:"null"
Maximum context length. Defaults to value from model’s config.json.
bool
default:"false"
Use a causal LM as an embedding model.
bool
default:"false"
Enable multimodal functionality for vision/audio models.
string
default:"null"
Model version (branch name, tag, or commit ID) to use from HuggingFace.

HTTP Server

string
default:"127.0.0.1"
Host address for the HTTP server.
int
default:"30000"
Port for the HTTP server.
bool
default:"false"
Use gRPC server instead of HTTP.
bool
default:"false"
Skip warmup phase on server startup.
string
default:"null"
API key for authentication. Clients must include this in the Authorization header.

Data Types and Quantization

string
default:"auto"
Data type for model weights and activations.Options: auto, half, float16, bfloat16, float, float32
string
default:"null"
Quantization method.Options: awq, fp8, gptq, marlin, gptq_marlin, awq_marlin, bitsandbytes, gguf
string
default:"auto"
KV cache data type.Options: auto, fp8_e5m2, fp8_e4m3, bf16, bfloat16, fp4_e2m1
bool
default:"false"
Use FP32 precision for language model head (logits).

Memory and Scheduling

float
default:"auto"
Fraction of GPU memory to allocate for static usage (model weights + KV cache).Automatically calculated based on GPU memory and configuration if not set.
int
default:"null"
Maximum number of requests being processed concurrently.
int
default:"null"
Maximum number of requests in the queue.
int
default:"null"
Maximum total tokens in KV cache pool. Limits memory usage.
int
default:"auto"
Maximum tokens to process in a single prefill batch.Automatically set based on GPU memory. Larger values improve throughput but require more memory.
bool
default:"false"
Enable dynamic chunking for variable-length prefill batches.
int
default:"16384"
Maximum tokens allowed in a single prefill request.
string
default:"fcfs"
Request scheduling policy. Options: fcfs (first-come-first-serve), lpm (longest-prefix-match)
bool
default:"false"
Enable priority-based scheduling. Requests can specify a priority value.

Parallelism

int
default:"1"
Tensor parallelism size. Split model across this many GPUs.
int
default:"1"
Data parallelism size. Run this many independent replicas.
int
default:"1"
Pipeline parallelism size. Distribute model layers across this many stages.
string
default:"auto"
Load balancing method for data parallelism.Options: auto, round_robin, shortest_queue, follow_bootstrap_room
int
default:"1"
Expert parallelism size for MoE models.

Multi-Node

int
default:"1"
Number of nodes for distributed serving.
int
default:"0"
Rank of this node (0 to nnodes-1).
string
default:"null"
Distributed initialization address. Format: host:portExample: 192.168.1.100:5000

CUDA Graph Optimization

int
default:"auto"
Maximum batch size for CUDA graph capture.Automatically set based on GPU memory. Higher values enable larger batches but use more memory.
bool
default:"false"
Disable CUDA graph optimization.
bool
default:"false"
Disable padding in CUDA graph batch sizes.

Cache Configuration

bool
default:"false"
Disable radix attention cache (prefix caching).
bool
default:"false"
Include cache hit rate statistics in API responses.
string
default:"lru"
Eviction policy for radix cache. Options: lru (least recently used), lfu (least frequently used)

Attention Backend

string
default:"null"
Attention mechanism backend.Options: flashinfer, triton, torch_native, fa3, fa4, flex_attentionAutomatically selected based on hardware if not specified.
string
default:"null"
Separate attention backend for prefill phase.
string
default:"null"
Separate attention backend for decode phase.
string
default:"null"
Sampling backend. Options: flashinfer, pytorch

LoRA Adapters

bool
default:"false"
Enable LoRA adapter support.
int
default:"null"
Maximum LoRA rank to support.
array[string]
default:"null"
Paths to LoRA adapters to load at startup.
int
default:"8"
Maximum number of different LoRA adapters in a single batch.
string
default:"csgmv"
LoRA computation backend. Options: triton, csgmv, torch_native

Speculative Decoding

string
default:"null"
Speculative decoding algorithm. Options: EAGLE, STANDALONE, NGRAM
string
default:"null"
Path to draft model for speculative decoding.
int
default:"null"
Number of speculative steps.
int
default:"null"
Number of draft tokens per step.

Disaggregation

string
default:"null"
Prefill-decode disaggregation mode.Options: null (no disaggregation), prefill (prefill server), decode (decode server)
string
default:"mooncake"
Transfer backend for PD disaggregation. Options: mooncake, nixl, fake
string
default:"null"
InfiniBand device(s) for disaggregation. Format: mlx5_0 or mlx5_0,mlx5_1

Logging and Monitoring

string
default:"info"
Logging level. Options: debug, info, warning, error
bool
default:"false"
Log all incoming requests and responses.
bool
default:"false"
Enable Prometheus metrics at /metrics endpoint.
bool
default:"false"
Show time cost breakdown in responses.

Advanced Options

int
default:"null"
Random seed for reproducibility.
int
default:"1"
Token interval for streaming responses.
float
default:"300"
Watchdog timeout in seconds. Kill worker if no heartbeat.
string
default:"null"
Directory for downloading models from HuggingFace.
int
default:"0"
Starting GPU ID for multi-GPU setups.
bool
default:"false"
Enable PyTorch compilation for improved performance.
bool
default:"false"
Enable peer-to-peer GPU connectivity check.
bool
default:"false"
Enable deterministic inference for reproducible outputs.

Model-Specific Options

string
default:"null"
Name to serve the model as. Defaults to model path.
string
default:"null"
Custom chat template (Jinja2 format).
string
default:"null"
Custom completion template.
string
default:"null"
Tool call parser for function calling. Options: hermes, qwen, glm
string
default:"null"
Reasoning parser for o1-style models.

Example Configurations

Small Model (8B)

Large Model with TP (70B)

Quantized Model

Multi-Node Setup

Data Parallelism

Disaggregated Setup

Production Server

Python API

All arguments can be used when creating an Engine:

See Also