Unit 1 of 13
What is SGLang?
What you’ll learn
- Name the processes a request crosses inside SGLang Runtime and say what each one does.
- Estimate how much prefill work prefix reuse saves for a workload that repeats a system prompt, and spot prompt layouts that defeat it.
- Explain what an OpenAI-compatible endpoint guarantees and what stays specific to the engine behind it.
- Launch SGLang v0.5.18 with a small model, send a first request, and confirm from the reply and the server log that it worked.
What SGLang is
Picture a support chatbot. Every request starts with the same 1,500-token system prompt (the rules, the tone, a few worked examples) followed by a 100-token customer question. At 1,000 requests an hour, a naive server runs the same 1,500 tokens through the model 1,000 times. The model’s answer to those tokens never changes, so almost all of that work is repeated.
SGLang is an open-source system for serving large language models that is built to notice repetition like this and skip it. It has two parts. SGLang Runtime (SRT) is the server: it accepts requests over HTTP, schedules them onto the GPU, keeps their KV cache, and streams tokens back. The frontend language is a Python library for writing multi-step generation programs (branches, choices, parallel calls) that run against a runtime. This course is mostly about the runtime, because that is what you deploy and operate.
By the end of this lesson you will know which processes a request passes through, what shared prompt prefixes buy you and how to arrange prompts to get it, what “OpenAI-compatible” does and does not promise, and how to launch SGLang and prove that a first request worked.
| Concern | Plain loop: `model.generate()` per request | SGLang Runtime |
|---|---|---|
| Concurrency | One request, or one fixed batch, at a time. Later arrivals wait for the whole batch to finish. | A scheduler adds and removes requests between decode steps (continuous batching). |
| Repeated prompt text | Every request prefills its whole prompt again. | A radix cache keeps KV entries for token prefixes and reuses them for any later request that starts the same way. |
| KV cache memory | Allocated per call and freed when the call returns. | One pool, sized at startup, shared by all requests and managed by the scheduler. |
| Client interface | A Python function call in your own process. | HTTP endpoints, including OpenAI-compatible ones, plus an in-process Python engine. |
| Turning tokens into text | Your loop decodes tokens itself, between GPU steps. | A separate detokenizer process does it, so the GPU loop does not wait on string handling. |
If continuous batching or the KV cache are new to you, read the batching lesson and the KV cache lesson in Foundations first. This course assumes both.
Follow a request through the runtime
SRT is several operating-system processes that pass messages to each other. Knowing which process does what tells you where to look when something is slow or broken. The figure follows one chat request; the numbers match the steps below it.
- 1. The HTTP server accepts the request
A FastAPI app in the main process receives
POST /v1/chat/completionsand checks the JSON body against the request schema. It never touches the GPU. - 2. The tokenizer manager prepares tokens
For a chat request it applies the model’s chat template, which wraps each message in the role markers the model was trained on, then tokenizes the result. The request gets an ID (
rid) that follows it through every process. - 3. Token IDs go to the scheduler
The processes talk over local ZeroMQ sockets. The scheduler puts the request in its waiting queue.
- 4. The scheduler matches the prefix and runs a batch
It looks up the longest prefix of the request’s tokens already held in the radix cache, reserves KV memory for the rest, and adds the request to the next batch. The model worker, which lives inside the scheduler process, runs the forward pass on the GPU: prefill for the unmatched tokens, then one decode step per new token.
- 5. New token IDs go to the detokenizer
After each step the scheduler sends the new token IDs to the detokenizer process, which turns them into text. Multi-byte characters can span several tokens, so this conversion is stateful and is kept away from the GPU loop.
- 6. Text streams back to the client
The detokenizer sends text to the tokenizer manager, which hands it to the waiting HTTP handler. With
stream: trueeach piece goes out as a server-sent event; otherwise the handler waits for the finished answer.
Two consequences are worth remembering. First, tokenizing and detokenizing run in other processes than the GPU loop, so string handling does not stall decoding. Second, the scheduler process is where the interesting behavior lives: batching, memory, prefix reuse, and the forward pass. The runtime lifecycle lesson opens it up.
Go deeperWhy SGLang splits the work across processes
Python runs one thread of bytecode at a time per process (the global interpreter lock). If one process parsed JSON, tokenized, detokenized, and also launched GPU kernels, every millisecond spent on strings would be a millisecond the GPU waits for its next batch. Splitting the work lets each process run on its own CPU core.
The docstring of Engine in python/sglang/srt/entrypoints/engine.py at v0.5.18 states the layout: the HTTP server, the engine, and the tokenizer manager run in the main process; the scheduler and the detokenizer are subprocesses; they communicate over ZeroMQ, each on its own port. With tensor parallelism the launcher starts one scheduler process per GPU rank, and the ranks run each batch together.
The same processes also back the in-process sgl.Engine, which drops only the HTTP layer. The offline engine lesson uses it for batch jobs and evaluation.
What repeated prompt structure buys you
Recall from the KV cache lesson that a token’s keys and values depend only on the tokens before it. So if two requests begin with the same tokens, the KV entries for that shared beginning are identical, and the second request can use the first one’s copy instead of recomputing it. SGLang calls this RadixAttention: the scheduler stores cached prefixes in a radix tree, a tree whose branches are token sequences, and matches every new request against it.
The match is exact and it starts at the first token. Reuse stops at the first token that differs, even if the rest of the prompt is identical. Meaning does not count, and neither do matching words in a different position, because the tokens and their positions are what determine the keys and values.
Notice a detail in request 3: after a timestamp, the first instruction word becomes ␣You with a leading space, a different token from You. Even the “same” text can tokenize differently once something is put in front of it.
Here is what reuse is worth for the support bot, served with Llama 3.1 8B. A forward pass costs about 2 floating-point operations (FLOPs) per parameter per token, which gives a floor on prefill time at the H100’s dense BF16 peak of about 989 TFLOPS.
1,000 requests: a 1,500-token system prompt plus a 100-token question each
- Prefill tokens without reuse
1,000 × (1,500 + 100) = 1,600,000 tokens - Prefill tokens with reuse
1,500 once + 1,000 × 100 = 101,500 tokens - Work saved
1,600,000 / 101,500 ≈ 15.8 times fewer tokens - System prompt prefill, per request
2 × 8.03 billion × 1,500 ≈ 24.1 trillion FLOPs - Time for that at 989 TFLOPS
24.1 × 10¹² / 989 × 10¹² ≈ 24 ms, at best - KV entries for the shared prefix
1,500 × 128 KiB = 187.5 MiB, stored once
ResultEach cache hit removes at least 24 ms of GPU time from that request's time to first token
The 24 ms is a lower bound: real kernels do not run at peak, so the saving on a real server is larger. Memory benefits too. If 32 requests are active at once, a plain server holds 32 copies of the prefix, 32 × 187.5 MiB = 6,000 MiB (about 5.9 GiB), while SGLang holds one copy of 187.5 MiB.
Structure beyond a single system prompt counts too. A multi-turn chat resends the whole conversation each turn, so turn 5 shares turns 1 to 4 with the previous request. Few-shot examples, agent tool descriptions, and a long document that several questions ask about all form shared prefixes. The RadixAttention lesson shows how the tree stores, matches, and evicts them.
Try it: measure prefix reuse on a laptop
The script below replays the support-bot workload through a toy prefix cache: a tree with one node per token, which is the idea behind SGLang’s radix tree without its compression or eviction. It compares three setups: a plain generate loop with no cache, prompts with the fixed system prompt first, and prompts that put a timestamp first. You need only Python 3.9 or later; the token IDs are random stand-ins in Llama 3’s vocabulary range.
import random
KV_BYTES_PER_TOKEN = 131_072 # Llama 3.1 8B in BF16, from the KV cache lesson
PREFILL_FLOPS_PER_TOKEN = 2 * 8.03e9 # about 2 FLOPs per parameter per token
H100_BF16_FLOPS = 989e12 # dense peak, so the times below are lower bounds
rng = random.Random(0)
class PrefixCache:
"""A token-level prefix tree with no eviction: a toy radix cache."""
def __init__(self):
self.root, self.stored = {}, 0
def serve(self, tokens):
node, reused = self.root, 0
for token in tokens:
if token in node:
reused += 1
else:
node[token] = {}
self.stored += 1
node = node[token]
return len(tokens) - reused # tokens that still need prefill
system = [rng.randrange(128_256) for _ in range(1_500)]
# Each question starts with a different token, then 99 random ones.
questions = [[1_000 + i] + [rng.randrange(128_256) for _ in range(99)]
for i in range(1_000)]
header = [rng.randrange(128_256) for _ in range(8)] # "Current time: 2026-09-30"
stamps = [header + [120_000 + i, 5, 6, 7] for i in range(1_000)] # "14:03:07"
layouts = {
"plain generate loop": ([system + q for q in questions], None),
"system prompt first": ([system + q for q in questions], PrefixCache()),
"timestamp first": ([s + system + q for s, q in zip(stamps, questions)],
PrefixCache()),
}
for name, (prompts, cache) in layouts.items():
computed = sum(cache.serve(p) if cache else len(p) for p in prompts)
seconds = computed * PREFILL_FLOPS_PER_TOKEN / H100_BF16_FLOPS
print(f"{name:<20} prefill tokens: {computed:>9,} at peak: {seconds:5.1f} s")
if cache:
gib = cache.stored * KV_BYTES_PER_TOKEN / 2**30
print(f"{'':<20} cached tokens: {cache.stored:>9,} KV: {gib:6.1f} GiB")plain generate loop prefill tokens: 1,600,000 at peak: 26.0 s
system prompt first prefill tokens: 101,500 at peak: 1.6 s
cached tokens: 101,500 KV: 12.4 GiB
timestamp first prefill tokens: 1,604,008 at peak: 26.0 s
cached tokens: 1,604,008 KV: 195.8 GiBRead it line by line. The plain loop prefills all 1,600,000 tokens, about 26 GPU-seconds even at peak. With the system prompt first, prefill drops to 101,500 tokens, matching the calculation above. With a timestamp first, reuse almost vanishes: the 8 tokens of Current time: 2026-09-30 match, then the clock digits differ, so 1,612,000 − 8 × 999 = 1,604,008 tokens are computed.
The KV column shows the other cost of a bad layout. Every unique token path becomes a cache entry. Sharing keeps the whole workload at 12.4 GiB, while the timestamp layout would need 195.8 GiB, far more than one GPU holds. A real radix cache evicts the least recently used entries, so it would not run out of memory; it would keep evicting entries and rarely hit.
On a real server you can watch the same effect. Send one request twice and look at the scheduler’s log: each prefill writes a line that starts with Prefill batch and reports #new-token and #cached-token. The second time, most of the prompt should appear under #cached-token. The runbook below walks through it.
Send a first request and verify it
SGLang offers endpoints shaped like OpenAI’s API, so the openai Python client and most tools that speak that API can talk to it by changing the base URL. It helps to be precise about what this promises. An OpenAI-compatible endpoint gives you a familiar request and response shape: the same paths, field names, and streaming format. It does not make the engine behind it behave like another engine.
| Same shape across compatible servers | Specific to SGLang and your launch flags |
|---|---|
POST /v1/chat/completions with model, messages, temperature, max_tokens, stream | How requests are batched and scheduled, and whether prefixes are reused |
choices[0].message.content and finish_reason in the reply | Which chat template renders the messages, and so the exact tokens the model sees |
Streamed chunks with delta fields, ending with data: [DONE] | Whether reasoning text or tool calls are split out, which depends on parser flags |
GET /v1/models listing the served model | Which models, precisions, kernels, and parallel layouts are supported |
The lesson’s code example, shown below the lesson, launches a server and sends one chat request. python3 -m sglang.launch_server loads Qwen/Qwen3-0.6B, a model small enough for almost any recent GPU. --host 127.0.0.1 keeps the server reachable only from the same machine, which is also the default; bind to another address only behind the access controls in the API lesson. Port 30000 is SGLang’s default port.
- Wait for readiness
Startup takes from seconds to minutes while weights load and the server warms up. It is ready when the log prints
The server is fired up and ready to roll!andGET /health_generatereturns HTTP 200. Before that, health checks return 503. - Check what is being served
GET /v1/modelsreturns the model ID clients should send. It is the model path unless you set--served-model-name. v0.5.18 does not reject other names, so this check is yours to make. - Send the request and read the reply
Run the
curlcommand. A good reply is JSON with the answer inchoices[0].message.content, afinish_reasonofstop(the model ended its answer) orlength(it ran out of tokens), and ausageblock with token counts. - Look at the server's side
The server log shows a
Prefill batchline for the request, followed byDecode batchlines while tokens are generated. If the reply arrived but no such lines appeared, you are talking to a different server.
Common mistakes
| Symptom | Likely cause | Fix |
|---|---|---|
curl fails with “connection refused” right after launch | The server is still loading weights or warming up. | Poll /health_generate until it returns 200 before sending traffic. |
The reply contains <think> text or strange role markers | The model’s reasoning output or template needs a model-specific parser or template. | Check the model’s SGLang documentation and set --reasoning-parser or --chat-template as it says. |
| Replies arrive even though the client sends a misspelled model name | In v0.5.18 the chat endpoint does not check model against the served model. It serves the request and echoes the name back. | Read /v1/models in the client, and reject unknown names at your gateway if clients choose between models. |
#cached-token stays at 0 for requests you expected to share a prefix | Something varies near the start of the prompt: a timestamp, a user ID, or a shuffled tool list. | Move per-request content after the fixed part and keep the fixed part byte-for-byte identical. |
| Out-of-memory errors at startup | --mem-fraction-static reserves more memory than the GPU has free, often because another process holds some. | Check nvidia-smi for other processes, then lower the fraction. |
| Other machines can reach the server’s admin endpoints | The server was started with --host 0.0.0.0 and no keys or gateway. | Bind to 127.0.0.1 until the access controls from the next lesson are in place. |
How teams run SGLang
- Pin the release. Docs at docs.sglang.io are not versioned and describe the newest code. This course pins v0.5.18; check a flag in
python/sglang/srt/server_args.pyat that tag before relying on it. - Start from defaults. Let SGLang pick the attention backend and memory fraction first. Change one setting at a time, and keep the first working launch command as your baseline.
- Design prompts for reuse. Fixed instructions, tool descriptions, and few-shot examples go first, identical for every request; per-request data goes last. This is the cheapest optimization SGLang offers.
- Measure reuse. Watch
#cached-tokenin thePrefill batchlog lines. OpenAI-compatible replies report cached tokens inusage.prompt_tokens_detailsonly when you launch with--enable-cache-report. - Know the scheduling default. In v0.5.18,
--schedule-policydefaults tofcfs(first come, first served). Other policies, such aslpm(longest prefix match), reorder the queue to raise reuse; the scheduling lesson compares them. - Treat the server as internal. v0.5.18 exposes cache, weight, and profiling controls on the same port as generation. Put a gateway in front before anyone outside your team can reach it.
Go deeperThe frontend language in one example
The frontend language describes a generation program in Python and sends it to a running server. Each += appends text or a generation call to the program’s state, and the runtime sees the shared parts of related calls as prefixes it can reuse.
import sglang as sgl
@sgl.function
def triage(s, ticket):
s += "You are a support agent. Classify the ticket, then reply.\n"
s += "Ticket: " + ticket + "\n"
s += "Category: " + sgl.select("category", choices=["billing", "bug", "other"])
s += "\nReply: " + sgl.gen("reply", max_tokens=80, stop="\n")
sgl.set_default_backend(sgl.RuntimeEndpoint("http://127.0.0.1:30000"))
state = triage.run(ticket="I was charged twice this month.")
print(state["category"], state["reply"])sgl.select scores each choice and keeps the most likely one, and sgl.gen generates free text. The select and the gen share everything before them, so the second call starts from cached state. Most production traffic reaches SGLang through HTTP instead, which is why this course focuses on the runtime.
Cheat sheet
- SGLang = SGLang Runtime (SRT), the server you deploy, plus a frontend language for generation programs.
- Path of a request: HTTP server and tokenizer manager (main process), scheduler with radix cache and model worker (one process per GPU), detokenizer, and back.
- Prefix reuse is exact and starts at token 0: reuse stops at the first differing token.
- Put fixed text first and per-request text last. A timestamp at the top can erase all reuse.
- Llama 3.1 8B: a 1,500-token shared prefix saves at least about 24 ms of H100 prefill per hit and 187.5 MiB of KV cache per extra copy.
- OpenAI-compatible means the request and response shape, not the same scheduling, templates, parsers, or outputs.
- Ready means
The server is fired up and ready to roll!in the log and HTTP 200 from/health_generate. - Watch
#cached-tokeninPrefill batchlog lines to confirm reuse.
Walkthrough
Launch SGLang and prove the first request worked
Code example Optional · Launch and call SGLang
python3 -m sglang.launch_server \
--model-path Qwen/Qwen3-0.6B \
--host 127.0.0.1 \
--port 30000
curl http://127.0.0.1:30000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"Qwen/Qwen3-0.6B","messages":[{"role":"user","content":"Define RadixAttention."}],"temperature":0}'Quick reference
APIs and configuration
| API or setting | What it does | Input | Output | Limitations |
|---|---|---|---|---|
launch_server | Start SGLang Runtime: the HTTP server, scheduler, and detokenizer processes. | --model-path, plus --host (default 127.0.0.1) and --port (default 30000). | A server that logs The server is fired up and ready to roll! once warmup succeeds. | Pin sglang==0.5.18 or the v0.5.18 image; the docs site describes newer code. |
GET /health_generate | Check that the server can actually generate, not just that the process is alive. | No body. The server itself submits a one-token request. | HTTP 200 when output arrives within 20 seconds; 503 while starting, shutting down, or stuck. | Each probe takes at least one second, so a Kubernetes probe needs more than its 1-second default timeout. |
GET /get_model_info | Report what the server is serving: model path, served name, and parser settings. | No body. | JSON with model_path, served_model_name, is_generation, reasoning_parser, and tool_call_parser. | Deprecated in v0.5.18 and logs a warning; new code should call /model_info. |
Optional deployment reference
Install SGLang v0.5.18 and send a streamed request
This runbook installs the pinned release in its own environment, starts Qwen/Qwen3-0.6B, and calls it through the OpenAI-compatible API with streaming. You need a Linux machine with a recent NVIDIA GPU. Run the server in one terminal and everything else in a second one.
Before you start
- A Linux host with an NVIDIA GPU, a working driver, and Python 3.10 or newer.
uvfor the virtual environment, or Docker with the NVIDIA Container Toolkit if you use thelmsysorg/sglang:v0.5.18image instead.- Network access to Hugging Face to download the model, about 1.5 GB for
Qwen/Qwen3-0.6B.
Install the pinned release and check the GPU
A fresh virtual environment keeps SGLang’s pinned PyTorch and kernel packages away from other projects. The version check proves that Python imports the release this course targets, and nvidia-smi proves the driver can see the GPU.
uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install 'sglang==0.5.18'
python -c "import sglang; print(sglang.__version__)"
nvidia-smiThe first print shows 0.5.18. nvidia-smi lists your GPU with little memory in use and no other large processes. If the version differs, you are in the wrong environment; if nvidia-smi fails, fix the driver before going further.
Launch the server
This starts the main process, one scheduler process, and a detokenizer. --mem-fraction-static 0.80 reserves 80% of GPU memory for the weights and the KV cache pool; the rest is left for activations and other working memory. The server listens only on the local machine.
python3 -m sglang.launch_server \
--model-path Qwen/Qwen3-0.6B \
--host 127.0.0.1 \
--port 30000 \
--mem-fraction-static 0.80The log shows the model loading and, at the end, The server is fired up and ready to roll!. From the second terminal, curl -i http://127.0.0.1:30000/health_generate returns HTTP/1.1 200. A 503 means it is still starting; a crash with an out-of-memory error means the fraction is too high for the free memory.
Discover the model and stream a reply
The client asks /v1/models for the ID instead of hard-coding it, then streams a reply with a 96-token limit. Streaming shows tokens as they arrive and proves the stream ends cleanly.
uv pip install openai
python - <<'PY'
from openai import OpenAI
c = OpenAI(base_url="http://127.0.0.1:30000/v1", api_key="EMPTY")
model = c.models.list().data[0].id
print("serving:", model)
stream = c.chat.completions.create(
model=model,
messages=[{"role":"user","content":"Explain RadixAttention in two sentences."}],
temperature=0, max_tokens=96, stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)
print()
PYThe first line is serving: Qwen/Qwen3-0.6B, then text appears piece by piece and the script exits on its own. Expect a <think> block at the start, because no reasoning parser is set, and the text may stop mid-sentence at the 96-token limit. A hang with no text means the request never reached the server; check the server log for a Prefill batch line.
Settings explained
| Setting | What it controls | Operational guidance |
|---|---|---|
model-path | The Hugging Face model ID or local directory to load. | Check the model’s page in the SGLang docs for required flags such as a reasoning or tool parser. |
mem-fraction-static | The share of GPU memory reserved for weights plus the KV cache pool. | Leave it unset first so SGLang picks a value. Lower it after an out-of-memory error; raise it only when you need more KV cache and have measured headroom. |
context-length | The longest prompt plus output the server accepts. Defaults to the model’s config.json. | Set it lower when your traffic never needs the full length, so one oversized request cannot claim a large share of the KV pool. |
attention-backend | Which attention kernels run on the GPU. | Keep the automatic choice until a benchmark on your hardware and workload shows another backend is faster. |
Validation checklist
/health_generatereturns 200 and/v1/modelslistsQwen/Qwen3-0.6B.- A non-streaming and a streaming request both finish with a
finish_reasonofstoporlength. - Sending the same prompt twice shows most of its tokens under
#cached-tokenin the secondPrefill batchlog line. - The startup log shows no out-of-memory errors or repeated warnings.
Optional exercise
Prove that a first SGLang request worked, from both the client and the server side.
- Record
sglang.__version__, the GPU and driver fromnvidia-smi, and the full launch command. - Read the model ID from
/v1/modelsand send one streamed request with it. - Send the same prompt twice more and copy the two
Prefill batchlog lines, noting#new-tokenand#cached-token. - Launch once more with
--reasoning-parser qwen3and note where the<think>text goes.
- What to save
- The launch command, version output,
/v1/modelsresponse, one full reply, and the twoPrefill batchlog lines showing the cache hit. - Test a failure
- Predict what happens, then send a request with the model name
wrong-model. In v0.5.18 it succeeds and the reply echoeswrong-model, because the name is not checked. Write down where in your stack a wrong name would be caught. - Cleanup
- Stop the server with Ctrl+C and confirm with
nvidia-smithat no SGLang process still holds GPU memory. Keep the virtual environment for the next lessons.
How to use it
When and how to use it
Use SGLang when you serve a model to many concurrent users over HTTP, especially when requests share long prefixes such as system prompts, few-shot examples, tool lists, or chat history. Start with one small model, prove the request path, and add features one at a time.
OpenAI-compatible APIs
Chat, completions, embeddings, and models endpoints that work with the openai client after a base URL change.
Native APIs
/generate and related endpoints expose SGLang-specific inputs and outputs, such as token IDs and cache statistics.
Prefix reuse
RadixAttention keeps KV entries for token prefixes and reuses them for every later request that starts with the same tokens.
Offline engine
sgl.Engine runs the same runtime inside a Python process for batch jobs and evaluation, with no HTTP layer.
System workflow
- 1
Read the model’s page in the SGLang docs for required template or parser flags.
- 2
Launch with defaults on
127.0.0.1and wait for/health_generateto return 200. - 3
Read the served model ID from
/v1/models. - 4
Send one non-streaming and one streaming request with
temperature0 and a token limit. - 5
Repeat a prompt and confirm prefix reuse in the
Prefill batchlog lines.
Launch one small model
python3 -m sglang.launch_server \
--model-path Qwen/Qwen3-0.6B \
--host 127.0.0.1 --port 30000The server loads the model and prints The server is fired up and ready to roll! when it can take requests.
Troubleshooting
If something goes wrong
| What you observe | Evidence to collect | Next experiment |
|---|---|---|
The model loads, but replies contain <think> blocks, role markers, or ignore the system message. | Save one full raw reply and read reasoning_parser in /model_info. Compare the model’s page in the SGLang docs with your launch flags. | Relaunch with the documented --reasoning-parser or --chat-template for that model and resend the same messages. Only write a custom template if the model ships without a correct one. |
| The server starts, but the first request crashes with a kernel or backend error. | Save the startup log lines that name the attention backend, the model architecture, the GPU, and the dtype, plus the full traceback of the failed request. | Remove any forced --attention-backend and optional feature flags and relaunch. Add them back one at a time to find the one that breaks. |
| An OpenAI client connects, but reasoning text or tool calls do not appear in their own fields. | Check reasoning_parser and tool_call_parser in /model_info. The API shape is compatible, but splitting those fields depends on parser flags. | Enable the parser documented for the model family and test a plain request, a reasoning request, and a tool request separately. |
#cached-token stays at 0 for traffic that should share a system prompt. | Tokenize two real prompts with /v1/tokenize and find the first position where the token lists differ. | Move whatever differs at that position (timestamps, user IDs, reordered tools) after the fixed text, then repeat the two requests and check the log again. |
| The server exits during startup with an out-of-memory error. | Run nvidia-smi to see what else holds GPU memory, and note the --mem-fraction-static value in the launch command. | Stop the other process or lower the fraction by 0.05 at a time until startup succeeds, then record the value that worked. |
Knowledge check