Scenario
The draft that declared 2,048 positions
RolesInference EngineeringLLM Product Engineering
- Engine
- SGLang 0.5.22
- Model
- Qwen/Qwen3-30B-A3B-Instruct-2507 with the lmsys/SGLang-EAGLE3-Qwen3-30B-A3B-Instruct-2507-SpecForge-Nex draft, and Qwen/Qwen3-8B with the Tengyunw/qwen3_8b_eagle3 draft
- Hardware
- one GB10 with unified memory, and one L4 as the second machine
Situation
A team adds EAGLE-3 speculation to its mixture-of-experts server on a GB10. They take the draft model and the shape from the cookbook: three steps, a top-k of one, four draft tokens. The start fails inside the draft worker with a ValueError about two context lengths, and the scheduler child exits.
Earlier the same day a colleague turned on the same feature for the dense 8B model on an L4, with its own trained draft, and the server came up without any change. The team concludes that the draft published for the 30B model is defective and prepares an issue for its authors, with a request for a new draft. You are asked to look at the two logs before the issue goes out.
Questions
- Which component raised the error, the target or the draft, and which two numbers does the check compare?
- The L4 pair started with no change. What differs between the two draft configs?
- The error message names an environment variable. What does setting it change, and what does it leave as it was?
- Read the pool lines of the start that worked. What did the draft cost in memory, and which request limit did speculation set?
- The benchmark prompts had 512 tokens. Which incident in the manual shows what a draft with 2,048 positions does on long inputs, and how would you test that before production?
Commit to a cause after each listing. Write it down before you read the next one.
Evidence
the end of the traceback of the refused start
Read the two context lengths in the ValueError and the last sentence of the message.
File "/home/rohit/sglang-lab/.venv/lib/python3.12/site-packages/sglang/srt/configs/model_config.py", line 794, in __init__
self._derive_context_length(context_length)
File "/home/rohit/sglang-lab/.venv/lib/python3.12/site-packages/sglang/srt/configs/model_config.py", line 1205, in _derive_context_length
raise ValueError(
ValueError: Warning: Target model's context_length (262144) is greater than the derived context_length (2048). This may lead to incorrect model outputs or CUDA errors. Note that the derived context_length may differ from max_position_embeddings in the model's config. To allow overriding this maximum, set the env var SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1
[2026-10-17 15:31:03] Received sigquit from a child process. It usually means the child failed.Source: manuals/sglang-101/capture/gpu/out-gb10/server-eagle3-no-env.log, lines 44-50
the 8B target and its draft on an L4, with no override
Read the draft type, the available memory after it, and the pool.
[2026-10-17 03:40:58] Load weight end. elapsed=0.67 s, type=LlamaForCausalLMEagle3, avail mem=4.50 GB, mem usage=1.90 GB.
[2026-10-17 03:40:59] KV Cache is allocated. dtype: torch.bfloat16, #tokens: 8827, K size: 0.61 GB, V size: 0.61 GB
[2026-10-17 03:40:59] Memory pool end. avail mem=3.22 GB
[2026-10-17 03:40:59] KV Cache is allocated. dtype: torch.bfloat16, #tokens: 8827, K size: 0.02 GB, V size: 0.02 GBSource: manuals/sglang-101/capture/gpu/out-l4/server-eagle3-no-env.log, lines 27-30
the settings line of the L4 start
Read context_len and max_running_requests.
[2026-10-17 03:41:40] max_total_num_tokens=8827, chunked_prefill_size=4096, max_prefill_tokens=16384, max_running_requests=48, context_len=40960, available_gpu_mem=1.19 GBSource: manuals/sglang-101/capture/gpu/out-l4/server-eagle3-no-env.log, lines 47-47
the command of the start that worked
Compare the first word with the end of the ValueError.
SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 sglang serve --model-path Qwen/Qwen3-30B-A3B-Instruct-2507 --host 127.0.0.1 --port 30000 --enable-cache-report --enable-metrics --mem-fraction-static 0.7 --speculative-algorithm EAGLE3 --speculative-draft-model-path lmsys/SGLang-EAGLE3-Qwen3-30B-A3B-Instruct-2507-SpecForge-Nex --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4Source: manuals/sglang-101/capture/gpu/out-gb10/server-eagle3.command.txt
the same check with the override set
The warning stays, and the next line says what the override changed.
[2026-10-17 15:20:18] Load weight end. elapsed=312.38 s, type=Qwen3MoeForCausalLM, avail mem=55.96 GB, mem usage=57.49 GB.
[2026-10-17 15:20:19] Warning: Target model's context_length (262144) is greater than the derived context_length (2048). This may lead to incorrect model outputs or CUDA errors. Note that the derived context_length may differ from max_position_embeddings in the model's config.
[2026-10-17 15:20:19] Overriding the draft model's max_position_embeddings to 262144.Source: manuals/sglang-101/capture/gpu/out-gb10/server-eagle3.log, lines 19-21
the two pools of the target and the draft
The two lines report the same token count with very different sizes.
[2026-10-17 15:20:23] KV Cache is allocated. dtype: torch.bfloat16, #tokens: 216775, K size: 9.92 GB, V size: 9.92 GB
[2026-10-17 15:20:23] Memory pool end. avail mem=34.44 GB
[2026-10-17 15:20:23] KV Cache is allocated. dtype: torch.bfloat16, #tokens: 216775, K size: 0.21 GB, V size: 0.21 GBSource: manuals/sglang-101/capture/gpu/out-gb10/server-eagle3.log, lines 27-29
what the override does and does not do
Two paragraphs. Read why the L4 start needed no override.
The variable only removes the check. It does not teach the draft to read long prompts, which is the failure in issue #6783 below. Our prompts had 512 tokens, so this run says nothing about long contexts.
We expected the same refusal on a 24 GB L4. We started `Qwen/Qwen3-8B` with the draft `Tengyunw/qwen3_8b_eagle3` and no variable, and the server started. That draft declares 40,960 positions, the same as its target, so the check had nothing to refuse. The variable belongs to one draft config, not to EAGLE-3. Compare `max_position_embeddings` in both configs before you set it.Source: manuals/sglang-101/sections/4-4-speculative-decoding.md, lines 92-94
The answer
Show the walkthrough
- Read the traceback from the bottom up to the first frame you recognise. The frames run from the scheduler into
maybe_init_draft_worker, then into the EAGLE draft worker, then into a model config, and the error is raised in_derive_context_length. So the check belongs to the draft's model config. It compares the target's context length, 262144, with the length it derived for the draft, 2048, and refuses because the target is larger. The last sentence of the message names the way out: setSGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1. - Compare with the L4 pair. On the L4 the target loaded with 6.41 GB free, the draft of type
LlamaForCausalLMEagle3loaded 1.90 GB more, the pool came out at 8,827 tokens, and the settings line readscontext_len=40960. That draft declares 40,960 positions, the same as its target, so the check had nothing to refuse. The variable belongs to one draft config, not to EAGLE-3. The manual's rule is to comparemax_position_embeddingsin both configs before you set it. - Read the start that worked. The cookbook command for this pair begins with the variable. With it set, the same warning about 262144 against 2048 still prints, and the next line says what changed: the draft's
max_position_embeddingsis overridden to 262144. The manual is exact about the meaning. The variable only removes the check. It does not teach the draft to read long prompts. - Read what the draft cost. The target pool holds 216,775 tokens at 9.92 GB each for K and V. The draft has a pool with the same token count at 0.21 GB each, after loading 1.58 GB of weights in 1.30 s. The start also reset
max_running_requeststo 48, the cap that every speculation handler sets when you do not set it yourself. On the L4 the same draft design cut the pool from 24,094 tokens to 8,827, so on a small card the draft takes the memory that the batch needs. - Find the incident that the override hides. Issue #6783 in the manual's incident list ran a 70B model with EAGLE-3 and a draft config of 2,048 positions and no rope scaling. Acceptance was 3.2 tokens at 1k input, 1.6 at 3k and 1.2 at 10k, and at 10k the server produced 63.9 tokens per second against 102.7 without speculation. Adding rope scaling and 131,072 positions to the draft config fixed it. The manual's GB10 run used 512-token prompts and says that it tells you nothing about long contexts. The test is to read
accept lenon the decode log lines, orsglang:spec_accept_lengthfrom the metrics, on your own longest prompts, and to compare the time per token with speculation off at the same prompts.
Show the resolution
The draft is not defective. Its config declares 2,048 positions, and the context length check refuses that against a 262,144-token target. The cookbook's command sets the variable for this pair, and with it the server started with a target pool of 216,775 tokens, a draft of 1.58 GB, and a cap of 48 running requests. The issue to the draft's authors was not sent.
The team then treated the variable as a removed check rather than a fix. They measured the acceptance length on their longest prompts with the decode log and the endpoint for metrics, and set --max-running-requests themselves from the concurrency where speculation still won in their sweep. If acceptance falls on long prompts the way it did in issue #6783, the next step is a draft config with rope scaling and enough positions, or no speculation for that traffic, not a larger override.
Show the wrong turns
“The draft model is broken, ask for a new one.”
The draft loaded and served once the check was removed. A config that declares 2,048 positions is a limit of that draft, not a defect in its weights.
“Set the variable everywhere EAGLE-3 runs.”
The L4 draft needed no variable, because its positions matched its target. Set it only for the draft config that needs it, after you compared the two configs.
“The override fixed it, so long prompts are fine.”
The override removes a check. In issue #6783 a draft with 2,048 positions fell to 1.2 accepted tokens at 10k input and made the server slower than no speculation.
“Lower the target's context length to 2048 so the check passes.”
That caps every request at the draft's limit and gives up the long contexts the 30B model was chosen for. Fix the draft config or test the limit instead.
Show the general rule
A refusal at startup is a contract check between two components, and the fastest way out is to turn the check off. Before you do, read what each side declared and what the check protects. An override that removes a check leaves the mismatch in place, so the measurement that the check stood in for, here the acceptance length on long prompts, becomes your job. Compare the two configs, remove the check only for the pair that needs it, and measure what it guarded.
Taught in
The speculative decoding page of SGLang 101 records both starts in what we measured on a GB10, gives the cap in the limit nobody asked for, and lists the long-prompt failure under incidents.