Repository navigation
Description
System Info
[Bug] Eagle3 speculative decoding silently drops tool_calls for gpt-oss on trtllm-serve
Summary
With gpt-oss-120b on trtllm-serve, enabling Eagle3 speculative decoding makes the server
return an empty tool_calls array and empty content, even though the model clearly decided
to call the function (its reasoning_content says so, and it emitted the tokens).
Disabling speculative decoding — changing nothing else — makes tool calling work correctly.
The Harmony adapter itself is active in both cases (reasoning_content is populated either way), so
this is not a model-detection or chat-template problem: the tool-call channel is lost specifically
when Eagle3 is on.
This may be the missing link between #8615 and #10612
Two open issues describe what look like the same underlying failure, seen from different angles:
- [Bug]: Infinite loop using speculative decoding gpt-oss-120b-Eagle3 on 1.2.0rc1 container and RTX Pro 6000 with Jan AI as UI #8615 (Investigating) — speculative decoding with
gpt-oss-120b-Eagle3produces corrupted
channel tokens:<|channel|>!!!!!!!!!!!!...and an infinite loop. - [Bug]: Structured output constantly misses proper channel establishment for batch and streaming and result is often malformed. #10612 (open) — the Harmony channel-establishment sequence
(<|channel|>final<|message|>, token IDs200005,17196,200008) is not generated, the
parser hits "Unexpected EOS while waiting for message header to complete", and falls back to
corrupted/empty output.
Our A/B adds the missing variable: Eagle3 is the trigger, and the damage lands on the Harmony
control tokens — which are exactly the rare, structural tokens a draft head is worst at predicting
(<|channel|>, <|message|>).
Our failure mode is the most dangerous of the three, because it is completely silent. #8615 loops
loudly; #10612 returns visibly malformed JSON. Here: HTTP 200, finish_reason: "stop", no warning —
the tool call simply is not there. A framework cannot tell this apart from "the model chose not to call
the tool".
(#7163 is closed and used xgrammar with no speculative_config, so it is a different path.)
Environment
| Container | nvcr.io/nvidia/tensorrt-llm/release:1.3.0rc13 |
| GPU | NVIDIA GB10 (DGX Spark), compute capability sm_121 |
| Driver | 580.159.03 |
| Backend | --backend pytorch, --tp_size 1 |
| Model | openai/gpt-oss-120b (MXFP4) |
| Draft model | nvidia/gpt-oss-120b-Eagle3-long-context |
Reproduction
A — WITH Eagle3 → tool_calls is empty (bug)
extra-llm-api-config.yml:
enable_attention_dp: false
disable_overlap_scheduler: false
enable_autotuner: false
cuda_graph_config:
max_batch_size: 4
speculative_config:
decoding_type: Eagle
max_draft_len: 5
speculative_model_dir: /opt/gpt-oss-120b-Eagle3/
kv_cache_config:
free_gpu_memory_fraction: 0.9
enable_block_reuse: falsetrtllm-serve openai/gpt-oss-120b \
--tokenizer <local snapshot path> \
--backend pytorch --tp_size 1 --max_batch_size 4 \
--host 0.0.0.0 --port 8005 \
--extra_llm_api_options extra-llm-api-config.ymlRequest:
curl -s http://127.0.0.1:8005/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model":"openai/gpt-oss-120b",
"messages":[{"role":"user","content":"What is the weather in Rome? Use the tool."}],
"tools":[{"type":"function","function":{
"name":"get_weather","description":"Get the weather of a city",
"parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],
"tool_choice":"auto","max_tokens":300}'Response (bug):
{
"message": {
"role": "assistant",
"content": "",
"reasoning_content": "User asks weather in Rome. Use function.",
"tool_calls": []
},
"finish_reason": "stop",
"usage": { "completion_tokens": 37 }
}Note: completion_tokens: 37 while the reasoning text is only ~10 words — the tool-call tokens were
generated and then dropped. reasoning_content being populated proves the Harmony adapter is active
(openai_server.py: use_harmony = (model_config.model_type == "gpt_oss")).
B — WITHOUT Eagle3 → works
Same command, same image, same model, same tokenizer, same request. Only the config differs — the
speculative_config block is removed:
enable_attention_dp: false
disable_overlap_scheduler: false
enable_autotuner: false
cuda_graph_config:
max_batch_size: 4
kv_cache_config:
free_gpu_memory_fraction: 0.9
enable_block_reuse: falseResponse (correct):
{
"tool_calls": [
{ "function": { "name": "get_weather", "arguments": "{\"city\": \"Rome\"}" } }
]
}Why this matters
The failure is silent: HTTP 200, finish_reason: "stop", no warning in the logs. An agent
framework sees an assistant message with empty content and no tool call, and simply believes the model
declined to act. Any multi-agent system built on tool calling will appear to "work" while doing
nothing — which is how we spent hours blaming the model.
Also worth noting: the DGX Spark playbook
(dgx-spark-playbooks/nvidia/speculative-decoding, Option 1) recommends exactly this Eagle3 recipe for
gpt-oss-120b on a single Spark. Anyone following it and then using tools will hit this.
Suggested area to look at
tensorrt_llm/serve/harmony_adapter.py — the token-batch path
(process_token_batch / _get_or_create_tool_call) versus how tokens are delivered when
Eagle3OneModelSampler is in use. The reasoning channel survives; the tool-call channel does not.
A loud error — or even a startup warning that tool calling is unsupported with speculative decoding —
would already be a large improvement over silently returning an empty tool_calls.
Who can help?
No response
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examplesfolder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
| Container | nvcr.io/nvidia/tensorrt-llm/release:1.3.0rc13 |
| GPU | NVIDIA GB10 (DGX Spark), compute capability sm_121 |
| Driver | 580.159.03 |
| Backend | --backend pytorch, --tp_size 1 |
| Model | openai/gpt-oss-120b (MXFP4) |
| Draft model | nvidia/gpt-oss-120b-Eagle3-long-context |
A — WITH Eagle3 → tool_calls is empty (bug)
config.yml:
enable_attention_dp: false
disable_overlap_scheduler: false
enable_autotuner: false
cuda_graph_config:
max_batch_size: 4
speculative_config:
decoding_type: Eagle
max_draft_len: 5
speculative_model_dir: /opt/gpt-oss-120b-Eagle3/
kv_cache_config:
free_gpu_memory_fraction: 0.9
enable_block_reuse: falseServer:
trtllm-serve openai/gpt-oss-120b \
--tokenizer <path to the local HF snapshot> \
--backend pytorch --tp_size 1 --max_batch_size 4 \
--host 0.0.0.0 --port 8000 \
--extra_llm_api_options config.ymlRequest:
curl -s http://localhost:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "openai/gpt-oss-120b",
"messages": [{"role": "user", "content": "What is the weather in Rome? Use the tool."}],
"tools": [{"type": "function", "function": {
"name": "get_weather",
"description": "Get the weather of a city",
"parameters": {"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]}}}],
"tool_choice": "auto",
"max_tokens": 300}'B — WITHOUT Eagle3 → works
Same image, same model, same tokenizer, same request. Only the speculative_config block is removed
from config.yml.
---
### Expected behavior
```markdown
The response should contain the tool call the model decided to make — which is exactly what happens
when Eagle3 is disabled:
```json
{
"message": {
"role": "assistant",
"tool_calls": [
{"function": {"name": "get_weather", "arguments": "{\"city\": \"Rome\"}"}}
]
}
}
---
### actual behavior
```markdown
With Eagle3 enabled, the tool call is silently lost:
```json
{
"message": {
"role": "assistant",
"content": "",
"reasoning_content": "User asks weather in Rome. Use function.",
"tool_calls": []
},
"finish_reason": "stop",
"usage": { "completion_tokens": 37 }
}
Three things are worth pointing out:
- The model did decide to call the function —
reasoning_contentliterally says "Use function." completion_tokens: 37, while the reasoning text is only ~10 words. The tool-call tokens were
generated and then dropped.- The Harmony adapter is active —
reasoning_contentbeing populated proves it
(openai_server.py:use_harmony = (model_config.model_type == "gpt_oss")). So this is not a
model-detection or chat-template problem.
There is no error, no warning, and finish_reason is "stop". The response is a perfectly valid
HTTP 200. An agent framework cannot distinguish this from "the model chose not to call the tool".
---
### additional notes
```markdown
### This may be the missing link between #8615 and #10612
Two **open** issues look like the same underlying failure seen from different angles:
- **#8615** (*Investigating*) — speculative decoding with `gpt-oss-120b-Eagle3` produces **corrupted
channel tokens** (`<|channel|>!!!!!!!!!!!!…`) and an infinite loop.
- **#10612** (*open*) — the Harmony **channel-establishment sequence**
(`<|channel|>final<|message|>`, token IDs `200005`, `17196`, `200008`) **is not generated**, the
parser hits *"Unexpected EOS while waiting for message header to complete"*, and falls back to
corrupted or empty output.
The A/B above adds the missing variable: **Eagle3 is the trigger**, and the damage lands on the Harmony
**control tokens** — precisely the rare, structural tokens (`<|channel|>`, `<|message|>`) that a draft
head is worst at predicting.
**This failure mode is the most dangerous of the three, because it is completely silent.** #8615 loops
loudly; #10612 returns visibly malformed JSON. Here everything looks fine and the tool call is simply
absent.
(#7163 is closed and used xgrammar with **no** `speculative_config` — a different path.)
### Suggested area to look at
`tensorrt_llm/serve/harmony_adapter.py` — the token-batch path (`process_token_batch` /
`_get_or_create_tool_call`) versus how tokens are delivered when `Eagle3OneModelSampler` is in use.
The reasoning channel survives; the tool-call channel does not.
### Why this matters beyond one user
The official DGX Spark playbook (`dgx-spark-playbooks/nvidia/speculative-decoding`, Option 1)
recommends **exactly this Eagle3 recipe** for gpt-oss-120b on a single Spark. Anyone who follows it and
then uses tools will hit this — and, because it is silent, will likely blame the model.
Even just a startup warning ("tool calling is not supported with speculative decoding") would be a large
improvement over returning an empty `tool_calls` with HTTP 200.
Before submitting a new issue...
- Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.
Activity
Saad-Mallebhari commentedon Aug 7, 2026
Hi @NPB2026
Thanks for the detailed A/B test breakdown and cross-referencing with #8615 and #10612.
Your findings pinpoint how speculative draft acceptance interacts with Harmony channel parsing.
gpt-ossrelies on structural control tokens (<|channel|>final<|message|>, token IDs200005,17196,200008) to transitiontensorrt_llm/serve/harmony_adapter.pyfromreasoning_contentparsing into_get_or_create_tool_callbuffering.When
Eagle3OneModelSamplerverifies and emits accepted token batches intrtllm-serve, draft token acceptance and verification slice extraction bypasses the channel state transition events expected byprocess_token_batch(). The reasoning channel populates because it precedes the structural control tokens, but the subsequent tool-call tokens fail channel classification and are silently dropped, returning HTTP 200 with an emptytool_callsarray.Ensuring
harmony_adapter.py's token stream parser receives un-batched control token boundaries during speculative draft verification would prevent silent tool-call drop.mshayeb commentedon Nov 10, 2026
Hi, I'd like to take on the root cause here. #17464 stops Harmony from discarding malformed tool-call messages, and #17439 adds a warning. Neither explains why the call is lost only when Eagle3 is enabled.
My plan:
harmony_adapter.py(process_token_batch) at batch size 1 and at batch sizes 2–6, including cases where<|call|>or the<|channel|>…<|message|>prelude lands mid-batch.I'll post findings here as I go. Could a maintainer assign this to me?
mshayeb commentedon Nov 10, 2026
Findings: CPU repro, batch handling, and Eagle3 accept path
TL;DR: Batching in
harmony_adapter.pyis not what loses the tool call. A malformed prelude loses it even at batch size 1. I found and fixed a smaller batch-size bug along the way: valid streamed content was dropped when the parser errors. On the Eagle3 side, I couldn't run gpt-oss-20b on an L40S. A Qwen3-8B + Eagle3 proxy run on the L40S showed no accept-side corruption. The gpt-oss Eagle3 draft can't propose<|constrain|>,<|call|>or<|return|>, which keeps #17437's mechanism plausible but unconfirmed.Environment: TensorRT-LLM main @
a0ce6c8474(1.4.0rc3), NVIDIA L40S (SM89), one-model Eagle3,max_draft_len=3.1. CPU repro: batch size
I fed Harmony token sequences through
create_openai_streaming_response→process_token_batchin every schedule below, put the deltas back together the way an OpenAI client would, and compared against batch size 1 and againstharmony_output_to_openai:<|call|>and each prelude token land mid-batch;analysischannel<|message|>(no parser error)<|start|>(HarmonyError)HarmonyError)<|start|>process_token_batchfeeds the parser one token at a time, and the non-streaming path parses the whole sequence at once with no batching at all.<|message|>is the worst case: the parser raises nothing, and the call just never appears.2. Secondary bug: streaming dropped valid content (fix ready)
When the parser raised a
HarmonyError,stateful_stream_harmony_tokens_to_openai_deltasreturned[]for the whole batch. That threw away the deltas of valid tokens earlier in the same batch, and the tokens after the bad one were never processed. Larger batches lose more, which is why Eagle3 is hit harder. Example: with a split after token 4, the streamed reasoning comes out as just"User"instead of the full sentence.The fix rejects only the token that caused the error, in both
process_token_batchandprocess_token_batch_to_messages. A new CPU test (test_harmony_batch_invariance.py, registered inl0_cpu.yml) requires identical output for every schedule. Without the fix, 2 of its cases fail; with it, all 91 harmony unit tests pass. PR to follow.This fix does not bring back a tool call from a malformed sequence. It only makes streaming output independent of batch size.
3. gpt-oss Eagle3 draft vocabulary
The Eagle3 draft I checked (
zhuyksir/EAGLE3-gpt-oss-20b-bf16) has a 32k reduced vocabulary, mapped to the target's throughd2t/t2d. Which Harmony control tokens it includes:<|start|>,<|channel|>,<|message|>,<|end|><|constrain|>,<|call|>,<|return|><|constrain|>sits in the middle of every JSON tool-call prelude (… to=functions.x <|constrain|>json<|message|>…). So with Eagle3, it can only come from the target's correction step, always at a rejection point, with the draft continuing from there. This matches the setup #17437 describes. The draft used in the original report may differ; it would be worth checking itst2dthe same way.4. Accept/commit path (code reading)
Both host-side commit paths check the stop criteria after each accepted token and break, so tokens shouldn't leak past
<|call|>:TorchSampler._process_draft_tokens(two-model path);SpecSamplerBase.update_requests→handle_stop_criteria(one-model path).I didn't find any code that rejects or rewrites control tokens specifically.
5. End-to-end on L40S
gpt-oss-20b can't run on an L40S (SM89) with current main:
W4A16_MXFP4MoE layers are only supported by Cutlass and Triton on SM90, and by TRTLLM-Gen on SM100+.So step 3 of the plan needs an SM90+ GPU.
Proxy on the L40S: Qwen3-8B + Eagle3 (
Tengyunw/qwen3_8b_eagle3).</tool_call>is set as a stop token to mimic<|call|>. As with gpt-oss,<tool_call>and</tool_call>are not in this draft's vocabulary. I ran 160 completions per config: 16 prompts, thinking on and off, greedy plus 4 sampled at temperature 0.8.use_rejection_sampling)max_tokens, and the baseline hit it too.<think>text, and each diverging pair still ends in the same valid tool call. I put these down to floating-point differences when several tokens are verified in one pass, but I haven't ruled out anything else.Where this leaves the root cause
<|constrain|>being impossible for the draft to propose.What would settle it: the raw output
token_idsfor one failing request with Eagle3, and the same request with Eagle3 off attemperature=0. If anyone has these from the original report, please share them. Otherwise I'll run the same capture on an SM90 GPU and post the diff.