Configuration¶
qix chooses its own run configuration. You start it with the model, and optionally the host and port. Everything else is derived at start from the machine and the checkpoint, and every choice is logged with its reason. This page says what is derived, by which program, from what; how serving profiles work; and which flags exist to override a choice.
A flag that you must set to get the fastest run on a supported model and GPU is a defect in auto-configuration. Report it.
Two programs make decisions, in this order:
qix-serve(C++,csrc/serve_auto/) decides the layout: how many processes, on which GPUs, behind which router.- The rank,
python3 -m tnd.serve(python/tnd/serve.py,python/tnd/config.py), decides everything inside one process: KV-cache size, batch size, prompt-token budget per step, KV storage type, kernels.
What qix-serve reads¶
| Input | How | Code |
|---|---|---|
| The GPUs | NVML, loaded with dlopen at run time: count, name, compute capability, memory, active NVLink links, driver and CUDA driver version. CUDA_VISIBLE_DEVICES narrows the set. |
csrc/serve_auto/node_probe.cpp |
| Host memory | Available memory, logged in the node line |
csrc/serve_auto/node_probe.cpp |
The checkpoint's config.json |
A local directory; else the Hugging Face cache; else a curl fetch from HF_ENDPOINT (default https://huggingface.co), unless HF_HUB_OFFLINE is set |
csrc/serve_auto/model_config.cpp:88-131 |
From config.json it takes the model_type, the architectures list, the routed-expert count
(n_routed_experts, num_local_experts or num_experts), whether the model has
compress_ratios, the weight-quantization method, and an estimate of the weight bytes
(csrc/serve_auto/serve_plan.h, ModelFacts).
The GPU family is b300, b200, h200, h100, other or none (csrc/serve_auto/serve_plan.cpp:14-36).
The name decides first; compute capability 10.3 alone also means b300, and 10.0 means b200.
A compute-capability-9 card whose name says neither H100 nor H200 is split by memory at 100 GiB.
A GH200 is other.
qix-serve refuses to start, with exit code 2, when the checkpoint declares a weight
quantization the loader cannot read (csrc/serve_auto/serving_profile.cpp:240-250). The loader
reads unquantized bf16 and fp16, fp8, compressed-tensors pack-quantized 4-bit (symmetric, group),
and mxfp4 for gpt-oss only.
Serving profiles¶
A serving profile is one JSON file in the profile directory. qix-serve loads every *.json file
there in name order (csrc/serve_auto/serving_profile.cpp:479), and the first profile whose
match block fits the checkpoint is used (:504). With none, the profile is default: one
process, layout unchanged.
The profile directory is chosen in this order (csrc/serve_auto/tnd_serve_main.cpp:98-111). The
first two are used as given; of the last three, the first that exists wins:
--profile-dir DIR$TND_SERVING_PROFILE_DIR<prefix>/share/tnd/serving-profiles, next to the installed binary/usr/share/tnd/serving-profilescsrc/serve_auto/profiles/in the source tree the binary was built from
match¶
| Key | Matches when |
|---|---|
model_type_prefix |
model_type starts with one of the strings |
architecture_contains |
an entry of architectures contains one of the strings |
exclude_model_type, exclude_architecture |
never, when one of these is present |
requires_compress_ratios |
config.json has compress_ratios |
n_routed_experts |
the routed-expert count equals this number |
A profile matches when model_type_prefix or architecture_contains names the checkpoint (either
one is enough) and every other key holds (csrc/serve_auto/serving_profile.cpp:394-413). A
checkpoint whose config.json could not be read matches no profile and runs under default.
rules¶
Rules are tried in order, and the first whose when holds decides
(csrc/serve_auto/serving_profile.cpp:423-477).
| Key | Meaning |
|---|---|
when.gpu_family |
the node's GPU family is in this list |
when.gpus |
exactly this many GPUs |
when.gpus_min |
at least this many GPUs |
when.weights_max_gpu_share |
the estimated weights are at most this share of one GPU's memory |
layout |
single (one process), replicas (one whole copy per GPU, behind tnd-node-router), or ep (expert-parallel groups) |
max_group |
with ep: the widest group; the group is the widest width up to this that divides the expert count |
refuse |
no layout: qix-serve logs the text and exits with code 2 |
reason |
the evidence for the rule, printed in the layout line |
args |
tnd.serve flags the rule adds. A flag you pass yourself wins, and the log prints an override line. |
env |
environment variables the rule sets for the rank |
decisions |
more key = value -- reason lines to log |
A profile may also carry refuse_without_gpu (the text used when no GPU is visible), notes
(log lines with their own when), and extra_checkpoint_quant.
supported-models.md lists the profiles in this tree and what their rules cover.
What the rank derives¶
python3 -m tnd.serve runs its own auto-configuration, on by default (--auto-config). From the
GPU (memory, memory bandwidth, SM count, compute capability) and the model's KV and weight sizes it
sets:
- the KV-cache pool, sized after the weights load (
--num-gpu-blocks 0, the default); - the batch cap,
max_num_seqs; - the prompt-token budget per step for chunked prefill;
- the per-sequence block budget (
--max-blocks-per-seq), from the model's context window and the pool; - the KV block size (16 tokens, or 128 for DeepSeek-V4 and DeepSeek-V4.1;
python/tnd/serve.py:5130-5142); - the sampling defaults, from the checkpoint's
generation_config.json(--generation-config auto).
Each choice is logged as an auto-config: line with its reason. A flag you pass always wins over
the derived value. --no-auto-config turns auto-config off in both places. qix-serve skips the
profile, logs auto-config: off (--no-auto-config); layout unchanged and starts one process
(csrc/serve_auto/tnd_serve_main.cpp:303-306). The rank then skips its own derivation and uses the
raw defaults and your flags.
qix-serve flags¶
From the usage text (csrc/serve_auto/tnd_serve_main.cpp:69-74):
usage: qix-serve [--dry-run [--assume-node <family>x<count>]] [--layout single|ep|replicas --group-size N [--groups N]] [--profile-dir DIR] [--rank-python PATH] [--plugin-config FILE] [--] <tnd.serve flags>
| Flag | Meaning |
|---|---|
--dry-run |
Print the plan and the commands; start nothing |
--assume-node <family>x<count> |
With --dry-run only: plan for another node, for example b200x4. Families: b300, b200, h200, h100. No GPU is probed. |
--layout single\|ep\|replicas |
Skip the profile's layout and use this one |
--group-size N |
With --layout: ranks per EP group, or the number of copies |
--groups N |
With --layout ep: number of groups (default 1) |
--profile-dir DIR |
Where the serving profiles are |
--rank-python PATH |
Start ranks as PATH -m tnd.serve |
--plugin-config FILE |
The plugin configuration file (plugins.md). qix-serve prints the provider table and hands the file to every rank and to the router in TND_PLUGIN_CONFIG. A file it refuses stops the launch with exit code 2. Without the flag and the variable, no file is read. |
-h, --help |
Print the usage line |
Every other argument goes to each rank unchanged. -- separates the two sets when needed.
Passing a layout flag of tnd.serve (--tensor-parallel-size, --expert-parallel-size,
--tp-rank, --ep-rank) with any value other than a size of 1 or a rank of 0 also skips the profile: qix-serve logs
layout left as set and starts one process (csrc/serve_auto/launch.cpp:25-26, :126-133). The
layout environment variables do the same (csrc/serve_auto/launch.cpp:27-29): TND_EP_WORLD_SIZE
or TND_TP_WORLD_SIZE other than 1, TND_EP_RANK or TND_TP_RANK other than 0, and any value of
TND_AUTOCONFIG_CHILD or TND_DISTRIBUTED_MANIFEST.
Environment read by qix-serve¶
| Variable | Meaning |
|---|---|
TND_SERVING_PROFILE_DIR |
The profile directory, when --profile-dir is not given |
TND_SERVE_LOG_DIR |
Where rank logs go in a multi-rank layout (default /var/log/tnd, else /tmp) |
TND_SERVE_RANK_PORT |
The first rank's port behind the router (default --port + 10000) |
TND_SERVE_MASTER_PORT |
The rendezvous port of an EP group (default $MASTER_PORT, else 29500) |
TND_ROUTE_KEY |
The router's placement key: session (default), load or pending. qix-serve refuses any other value (csrc/serve_auto/launch.cpp:277-279). tnd-node-router run by hand also takes prefix, through --route-key or this variable (csrc/distributed/node_router_main.cpp:97-104). |
TND_NODE_ROUTER |
Path of tnd-node-router, when it is not on PATH or next to qix-serve |
TND_SERVE_RANK_CMD |
The command that starts a rank. Default: tnd-serve-launch -- when that wrapper is on PATH (it ships with the .deb package only), else python3 -m tnd.serve (csrc/serve_auto/tnd_serve_main.cpp:121-128) |
TND_PLUGIN_CONFIG |
The plugin configuration file, when --plugin-config is not given |
CUDA_VISIBLE_DEVICES |
The GPUs qix-serve may use |
HF_HUB_OFFLINE, HF_ENDPOINT |
How config.json is fetched (above) |
TND_ROUTE_KEY changes which copy a request lands on, and so how often a prompt hits the prefix
cache. CUDA_VISIBLE_DEVICES changes the GPU count, and so the layout. The rest say where things
are.
tnd.serve flags¶
python3 -m tnd.serve --help prints the full list (build_arg_parser, python/tnd/serve.py:1649). The ones most
users meet:
| Flag | Meaning |
|---|---|
--model |
Hugging Face id or local path. Required. |
--model-revision |
The exact commit to read config, tokenizer and weights from |
--host, --port |
Bind address. Default 127.0.0.1 and 8000. |
--dtype |
auto, float16, bfloat16 or float32 |
--trust-remote-code |
Pass trust_remote_code=True to the Hugging Face loaders |
--generation-config auto\|off |
Use the checkpoint's sampling defaults, or the OpenAI constants |
--no-auto-config |
Turn off auto-config: qix-serve skips the profile and starts one process, and the rank skips its own derivation |
--no-prefix-caching |
Turn off prefix caching (on by default) |
--kv-cache-dtype auto\|fp8_e4m3fn |
KV storage type. Unset: auto-config decides. fp8_e4m3fn is lossy. |
--quantization |
Weight quantization of the linear layers: fp8_e4m3fn, w4a16 or int8_w8a8. Lossy. |
--gpu-memory-utilization, --num-gpu-blocks, --max-num-seqs, --max-num-batched-tokens, --max-blocks-per-seq, --block-size |
Override a value auto-config derives |
--tensor-parallel-size, --expert-parallel-size |
Set the layout yourself (see above) |
--sleep-remote |
Let peers that are not loopback call /sleep, /wake_up and /is_sleeping (operations.md). Default off. |
--plugin-config |
The plugin configuration file (plugins.md). Default none. |
Two settings that change output¶
Auto-configuration only chooses settings that rearrange work. Two settings change the tokens the model produces, and qix does not turn them on unless a rule names its measurement:
--kv-cache-dtype fp8_e4m3fn(KV stored in 8 bits);--quantization(weights in 8 or 4 bits).
The auto-config: kv_cache_dtype= and auto-config: quantization= lines say what was chosen and
why.