Skip to content

[Rust Frontend] Build the Kimi K3 full-output grammar from its parser mode - #59190

Merged
BugenZhao merged 4 commits into
mainfrom
bz/k3-full-output-grammar
Oct 12, 2026
Merged

BugenZhao merged 4 commits into
mainfrom
bz/k3-full-output-grammar

Conversation

@BugenZhao

@BugenZhao BugenZhao commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Purpose

Kimi K3 grammars only cover the output after reasoning. KimiK3StructuralTagBuilder takes a reasoning option that stands for both the request's thinking mode and the grammar's starting point, so the engine's reasoning gate decides when the grammar activates. The builder also requires a response channel on every path, which rejects tool calls directly after reasoning.

Step 3 of the parser-owned output grammar rollout, following the grammar replay harness (#59143), the argument grammar split (#59395), and the shared schema root (#59408), all merged. The Kimi K3 parser already derives its starting channel from the prompt. This PR builds the whole generation's grammar from that initialized mode, so the engine constrains K3 from token zero (reasoning_ended = Some(true)). The open-PR search found no other Rust K3 full-output grammar work; token-aware K3 parsing (#58358, merged) is a separate track.

  • New unified/kimi_k3/grammar.rs builds the topology from KimiK3Mode:

    Tool choice After think closes After response closes
    auto response [tools], or tools [tools]
    required [response] tools tools
    named [response] tools, one call tools, one call

    A prompt-opened think or response channel continues its body. A prompt that opened no channel may first emit a whole think channel. Every path may end with the message close. Named choices and parallel_tool_calls=false allow one call.

  • Free-text regions keep today's string-level exclusions, which stay within what the token-aware parser ([Rust Frontend] Token-aware marker parsing for Kimi K3 #58358) accepts. Token-level exclusions are a follow-up.

  • KimiK3StructuralTagBuilder is removed. Its call tag and XtmlArguments syntax, with the xtml_type mapping from [Rust Frontend] Share SchemaRoot between argument coercion and grammars #59408, move into grammar/arguments.rs. The call tag no longer reads the builder's any_order and max_whitespace_cnt options, so it uses their defaults, as the serving path already did.

  • Model-owned grammars normalize the request's tools with xgrammar_structural_tag::normalize_tool_choice, public since 0.4.1 (bumped in [Rust Frontend] Use the MiMo structural-tag builder #59148). This is the same normalization build_structural_tag applies before a crate builder, so K3 sees the same tools, BuilderToolChoice, and validation errors as builder-backed models.

Out of scope: answer constraints (Step 4) and the ordinary-chat grammar skeleton. Requests without a tool grammar still get none.

Test Plan

cd rust
cargo nextest run -p vllm-parser kimi_k3
cargo nextest run -p vllm-chat --test roundtrip --test grammar_replay
cargo nextest run -p vllm-parser -p vllm-chat
cargo clippy --workspace --all-targets --all-features -- -D warnings

Unit tests snapshot the grammar for each start mode and tool choice with the shared outline renderer, with call bodies elided to .. (the argument tests cover them). Example: Reasoning plus required:

sequence
  tag `` text excluding [`<|close|>think<|sep|>`, `<|end_of_msg|>`] `<|close|>think<|sep|>`
  sequence
    optional tag `<|open|>response<|sep|>` text excluding [`<|open|>`, `<|close|>`, `<|end_of_msg|>`] `<|close|>response<|sep|>`
    tag `<|open|>tools<|sep|>` .. `<|close|>tools<|sep|>`
      tags_with_separator `` at_least_one
        tag `<|open|>call tool="get_weather" index="` `..` `<|close|>call<|sep|>`
        tag `<|open|>call tool="add" index="` `..` `<|close|>call<|sep|>`
  optional `<|close|>message<|sep|>`

Test Result

AI assistance: implementation and validation assisted by Claude Code.

🤖 Generated with Claude Code

@BugenZhao
BugenZhao added this pull request to stack #59163 September 29, 2026 09:35
@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch from ce1219c to 2c427d7 Compare September 29, 2026 09:51
@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch 2 times, most recently from 1650e5d to 8b15f5d Compare September 30, 2026 01:34
Base automatically changed from bz/output-grammar-replay to main September 30, 2026 07:29
@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch from 8b15f5d to ea7763b Compare September 30, 2026 07:30
@BugenZhao

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #92074 for commit ea7763bbdcd5.

@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch from ea7763b to c54a65c Compare September 30, 2026 08:21
@BugenZhao
BugenZhao removed this pull request from stack #59163 September 30, 2026 08:21
@BugenZhao
BugenZhao changed the base branch from main to bz/argument-grammar September 30, 2026 08:21
@BugenZhao
BugenZhao added this pull request to stack #59397 September 30, 2026 08:21
@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch from c54a65c to d178ebb Compare September 30, 2026 08:52
@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch from d178ebb to a116b4a Compare September 30, 2026 09:15
@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch from a116b4a to 690f651 Compare September 30, 2026 11:32
@mergify

mergify Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @BugenZhao.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Oct 1, 2026
Base automatically changed from bz/argument-grammar to main October 1, 2026 05:43
@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch from 690f651 to f144328 Compare October 1, 2026 08:43
@mergify mergify Bot removed the needs-rebase label Oct 1, 2026
@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch from 48e4647 to 8392a1b Compare October 7, 2026 07:07
@mergify

mergify Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @BugenZhao.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Oct 7, 2026
@vllm-agent

vllm-agent commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

CI selector (shadow): no narrower answer, every step runs: 194 test steps (270 jobs) instead of 7 (7 jobs)

Shadow mode: this changes nothing about what CI runs. It shows what the evidence-based selector would pick for this PR, next to today's rules. How it works.

Feedback welcome: reply here if it would skip a step this change needs, or runs something unrelated.

steps (jobs) Today's rules Selector Would skip Would add
NVIDIA, CPU and others 7 (7) 194 (270) 0 (0) 187 (263)
AMD mirrors 5 (5) 161 (225) 0 (0) 156 (220)

Why: rust: rust/src/chat/tests/grammar_replay/Kimi-K3.json: root crate bucket; 16 gate-env steps + 12 hardware-image steps; + the PyO3 bridge claim (vllm/tool_parsers/rust_tool_parser.py)

Selector would run (194)
  • amd-fp8-moe-kernels-mi355
  • amd-kernels-mi355
  • amd-lm-eval-small-models-harness
  • amd-native-quantization-kernels-mi355
  • amd-qwen3-next-mtp-async-eplb-accuracy
  • arm-cpu-test ×3
  • ascend-npu-test
  • async-engine-inputs-utils-worker
  • basic-correctness ×2
  • basic-correctness-cpu-offload
  • basic-correctness-cumem
  • basic-correctness-prefetch-offload
  • basic-correctness-sleep-mode
  • basic-models-test-other-cpu
  • basic-models-tests-extra-initialization ×14
  • basic-models-tests-initialization
  • basic-models-tests-other
  • batch-invariance-b200
  • batch-invariance-h100
  • benchmarks-cli-test
  • cpu-distributed-tests-dp-tp
  • cpu-distributed-tests-pp-tp
  • cpu-kernel-tests ×2
  • cpu-language-generation-and-pooling-model-tests ×3
  • cpu-multi-modal-model-tests-n ×4
  • cpu-multimodal-config
  • cpu-params-env-tokenizers-parser
  • cpu-quantization-model-tests
  • cpu-qwen2-5-vl-multimodal-tests
  • cpu-reasoning-renderers
  • cpu-spec-decode-tests
  • cpu-tool-parsers
  • crcr-report
  • crosslayer-kv-layout-distributed-nixlconnector-pd-accuracy-tests-4-gpus
  • cudagraph
  • deepseek-v4-kernel-test-b200
  • deepseek-v4-kernel-test-h100
  • distributed-comm-ops
  • distributed-compile-comm-4-gpus
  • distributed-compile-rpc-tests-2-gpus
  • distributed-compile-unit-tests-2xh100
  • distributed-dp-tests-2-gpus
  • distributed-dp-tests-4-gpus
  • distributed-flashinfer-nixlconnector-pd-accuracy-4-gpus
  • distributed-model-tests-2-gpus ×3
  • distributed-mooncakeconnector-pd-accuracy-4-gpus
  • distributed-nixlconnector-pd-accuracy-4-gpus
  • distributed-torchrun-examples-4-gpus
  • distributed-torchrun-shutdown-tests-2-gpus
  • docker-build-metadata
  • dp-ep-distributed-nixlconnector-pd-accuracy-tests-4-gpus
  • dsv41-mono-decode-numerics-amd
  • e2e-core-1-gpu
  • e2e-core-large-memory
  • e2e-scheduling-1-gpu
  • e2e-scheduling-accuracy-1-gpu
  • elastic-ep-scaling-test
  • engine
  • engine-1-gpu
  • entrypoints-integration-api-server ×4
  • entrypoints-integration-api-server-generate
  • entrypoints-integration-api-server-openai-chat_completion
  • entrypoints-integration-api-server-openai-completion
  • entrypoints-integration-llm
  • entrypoints-integration-multimodal
  • entrypoints-integration-pooling
  • entrypoints-integration-responses-api
  • entrypoints-integration-speech_to_text
  • entrypoints-unit-tests
  • eplb-algorithm
  • eplb-execution
  • examples
  • extract-hidden-states-integration
  • extract-hidden-states-integration-2-gpus
  • fault-tolerance-e2e-2xh100
  • fusion-and-compile-unit-tests-2xb200
  • fusion-e2e-config-sweep-h100
  • fusion-e2e-quick-h100
  • fusion-e2e-tp2-ar-rms-config-sweep-h100
  • fusion-e2e-tp2-ar-rms-dynamo-partition-amd
  • fusion-e2e-tp2-ar-rms-inductor-partition-amd
  • fusion-e2e-tp2-b200
  • fusion-e2e-tp2-quick-h100
  • gemm-rs-ar-2xb200
  • glm5next-unit-tests
  • hybrid-ssm-nixlconnector-pd-accuracy-tests-4-gpus
  • hybrid-ssm-nixlconnector-pd-prefix-cache-2-gpus
  • inkling-unit-tests-b200
  • intel-hpu-test
  • jit-monitor-no-runtime-jit
  • kernels-attention-diffkv-test-h100
  • kernels-attention-test ×7
  • kernels-b200 ×3
  • kernels-core-operation-test ×3
  • kernels-deepgemm-test-h100
  • kernels-fla-ops-test-b200
  • kernels-flashmla-test-h100
  • kernels-fusedmoe-layer-test-2-b200s
  • kernels-fusedmoe-layer-test-2-h100s
  • kernels-helion-test ×5
  • kernels-mamba-test
  • kernels-mhc-test-b200
  • kernels-minimax-m3-attention-b200
  • kernels-minimax-reduce-rms-test-2-gpus
  • kernels-moe-test ×5
  • kernels-quantization-test ×6
  • kernels-root-misc-test-b200
  • kimi-k3-prefix-cache-4xb200 ×2
  • kimi-k3-unit-tests-b200
  • kv-offload-large
  • kv-offload-medium
  • kv-offload-small
  • language-models-tests-extra-standard ×2
  • language-models-tests-granite-l4-compatibility
  • language-models-tests-hybrid ×2
  • language-models-tests-standard
  • lm-eval-dspark-watermark-2xh100
  • lm-eval-small-models
  • lm-eval-turboquant-k3v4nc
  • lm-eval-turboquant-k8v4
  • lm-eval-turboquant-t3nc
  • lm-eval-turboquant-t4nc
  • lm-eval-watermarking
  • lora ×4
  • lora-tp-distributed ×4
  • metrics-tracing-2-gpus
  • model-executor
  • mooncake-ec-tcp-e2e-2-gpus
  • mrcr-eval-small-models
  • multi-modal-accuracy-eval-small-models
  • multi-modal-models-standard-1-qwen2
  • multi-modal-models-standard-2-qwen3-gemma
  • multi-modal-models-standard-3-llava-qwen2-vl
  • multi-modal-models-standard-4-other-whisper
  • multi-modal-processor ×4
  • multi-modal-processor-cpu ×4
  • multiconnector-nixl-offloading-pd-accuracy-2-gpus
  • multiconnector-nixl-offloading-pd-edge-cases-2-gpus
  • nixlconnector-pd-edge-cases-2-gpus
  • openai-api-correctness
  • pipeline-context-parallelism-4-gpus
  • platform-tests
  • plugin-tests-2-gpus
  • push-nixlconnector-pp-prefill-pd-accuracy-4-gpus
  • pytorch-compilation-dynamic-shapes
  • pytorch-compilation-passes-unit-tests
  • pytorch-compilation-unit-tests
  • pytorch-compilation-unit-tests-h100
  • pytorch-fullgraph-cudagraph-l4-compatibility
  • pytorch-fullgraph-test
  • pytorch-nightly-dependency-override-check
  • quantization ×4
  • quantized-fusions
  • quantized-models-test
  • quantized-moe-test-b200
  • qwen4-exp-unit-tests
  • qwen4-exp-unit-tests-cpu
  • ray-dependency-compatibility-check
  • rayexecutorv2-4-gpus
  • regression
  • replayssm-e2e
  • rl-entrypoints-tests
  • rust-frontend-cargo-style-clippy
  • rust-frontend-cargo-tests
  • rust-frontend-core-correctness
  • rust-frontend-distributed
  • rust-frontend-openai-coverage
  • rust-frontend-serve-admin-coverage
  • rust-frontend-tool-use
  • samplers-multimodal-beam-search
  • samplers-test
  • scale-out-ec-e2e-2-gpus
  • sharded-rdt-weight-transfer
  • spec-decode-draft-model ×4
  • spec-decode-eagle-1-deepseek-qwen
  • spec-decode-eagle-2-llama3-qwen-vl-other
  • spec-decode-mtp-deepseek-mimo
  • spec-decode-mtp-gemma4
  • spec-decode-mtp-qwen3-5
  • spec-decode-ngram-suffix
  • spec-decode-speculators
  • torch-stable-abi-audit
  • v1-attention-b200 ×2
  • v1-attention-h100-mi300 ×2
  • v1-core
  • v1-executor-worker
  • v1-kv-connectors ×4
  • v1-kv-offload
  • v1-logits-oracle
  • v1-metrics-lmeval
  • v1-others-cpu
  • v1-sample
  • v1-spec-decode
  • vllm-ir-tests
Would skip (today's rules run them) (0)

none

Would add (today's rules do not run them) (187)
  • amd-fp8-moe-kernels-mi355 (code map)
  • amd-kernels-mi355 (code map)
  • amd-lm-eval-small-models-harness (code map)
  • amd-native-quantization-kernels-mi355 (code map)
  • amd-qwen3-next-mtp-async-eplb-accuracy (code map)
  • arm-cpu-test ×3 (code map)
  • ascend-npu-test (code map)
  • async-engine-inputs-utils-worker (code map)
  • basic-correctness ×2 (code map)
  • basic-correctness-cpu-offload (code map)
  • basic-correctness-cumem (code map)
  • basic-correctness-prefetch-offload (code map)
  • basic-correctness-sleep-mode (code map)
  • basic-models-test-other-cpu (code map)
  • basic-models-tests-extra-initialization ×14 (code map)
  • basic-models-tests-initialization (code map)
  • basic-models-tests-other (code map)
  • batch-invariance-b200 (code map)
  • batch-invariance-h100 (code map)
  • benchmarks-cli-test (code map)
  • cpu-distributed-tests-dp-tp (code map)
  • cpu-distributed-tests-pp-tp (code map)
  • cpu-kernel-tests ×2 (code map)
  • cpu-language-generation-and-pooling-model-tests ×3 (code map)
  • cpu-multi-modal-model-tests-n ×4 (code map)
  • cpu-multimodal-config (code map)
  • cpu-params-env-tokenizers-parser (code map)
  • cpu-quantization-model-tests (code map)
  • cpu-qwen2-5-vl-multimodal-tests (code map)
  • cpu-reasoning-renderers (code map)
  • cpu-spec-decode-tests (code map)
  • cpu-tool-parsers (code map)
  • crcr-report (code map)
  • crosslayer-kv-layout-distributed-nixlconnector-pd-accuracy-tests-4-gpus (code map)
  • cudagraph (code map)
  • deepseek-v4-kernel-test-b200 (code map)
  • deepseek-v4-kernel-test-h100 (code map)
  • distributed-comm-ops (code map)
  • distributed-compile-comm-4-gpus (code map)
  • distributed-compile-rpc-tests-2-gpus (code map)
  • distributed-compile-unit-tests-2xh100 (code map)
  • distributed-dp-tests-2-gpus (code map)
  • distributed-dp-tests-4-gpus (code map)
  • distributed-flashinfer-nixlconnector-pd-accuracy-4-gpus (code map)
  • distributed-model-tests-2-gpus ×3 (code map)
  • distributed-mooncakeconnector-pd-accuracy-4-gpus (code map)
  • distributed-nixlconnector-pd-accuracy-4-gpus (code map)
  • distributed-torchrun-examples-4-gpus (code map)
  • distributed-torchrun-shutdown-tests-2-gpus (code map)
  • docker-build-metadata (code map)
  • dp-ep-distributed-nixlconnector-pd-accuracy-tests-4-gpus (code map)
  • dsv41-mono-decode-numerics-amd (code map)
  • e2e-core-1-gpu (code map)
  • e2e-core-large-memory (code map)
  • e2e-scheduling-1-gpu (code map)
  • e2e-scheduling-accuracy-1-gpu (code map)
  • elastic-ep-scaling-test (code map)
  • engine (code map)
  • engine-1-gpu (code map)
  • entrypoints-integration-api-server ×4 (code map)
  • entrypoints-integration-api-server-generate (code map)
  • entrypoints-integration-api-server-openai-chat_completion (code map)
  • entrypoints-integration-api-server-openai-completion (code map)
  • entrypoints-integration-llm (code map)
  • entrypoints-integration-multimodal (code map)
  • entrypoints-integration-pooling (code map)
  • entrypoints-integration-responses-api (code map)
  • entrypoints-integration-speech_to_text (code map)
  • entrypoints-unit-tests (code map)
  • eplb-algorithm (code map)
  • eplb-execution (code map)
  • examples (code map)
  • extract-hidden-states-integration (code map)
  • extract-hidden-states-integration-2-gpus (code map)
  • fault-tolerance-e2e-2xh100 (code map)
  • fusion-and-compile-unit-tests-2xb200 (code map)
  • fusion-e2e-config-sweep-h100 (code map)
  • fusion-e2e-quick-h100 (code map)
  • fusion-e2e-tp2-ar-rms-config-sweep-h100 (code map)
  • fusion-e2e-tp2-ar-rms-dynamo-partition-amd (code map)
  • fusion-e2e-tp2-ar-rms-inductor-partition-amd (code map)
  • fusion-e2e-tp2-b200 (code map)
  • fusion-e2e-tp2-quick-h100 (code map)
  • gemm-rs-ar-2xb200 (code map)
  • glm5next-unit-tests (code map)
  • hybrid-ssm-nixlconnector-pd-accuracy-tests-4-gpus (code map)
  • hybrid-ssm-nixlconnector-pd-prefix-cache-2-gpus (code map)
  • inkling-unit-tests-b200 (code map)
  • intel-hpu-test (code map)
  • jit-monitor-no-runtime-jit (code map)
  • kernels-attention-diffkv-test-h100 (code map)
  • kernels-attention-test ×7 (code map)
  • kernels-b200 ×3 (code map)
  • kernels-core-operation-test ×3 (code map)
  • kernels-deepgemm-test-h100 (code map)
  • kernels-fla-ops-test-b200 (code map)
  • kernels-flashmla-test-h100 (code map)
  • kernels-fusedmoe-layer-test-2-b200s (code map)
  • kernels-fusedmoe-layer-test-2-h100s (code map)
  • kernels-helion-test ×5 (code map)
  • kernels-mamba-test (code map)
  • kernels-mhc-test-b200 (code map)
  • kernels-minimax-m3-attention-b200 (code map)
  • kernels-minimax-reduce-rms-test-2-gpus (code map)
  • kernels-moe-test ×5 (code map)
  • kernels-quantization-test ×6 (code map)
  • kernels-root-misc-test-b200 (code map)
  • kimi-k3-prefix-cache-4xb200 ×2 (code map)
  • kimi-k3-unit-tests-b200 (code map)
  • kv-offload-large (code map)
  • kv-offload-medium (code map)
  • kv-offload-small (code map)
  • language-models-tests-extra-standard ×2 (code map)
  • language-models-tests-granite-l4-compatibility (code map)
  • language-models-tests-hybrid ×2 (code map)
  • language-models-tests-standard (code map)
  • lm-eval-dspark-watermark-2xh100 (code map)
  • lm-eval-small-models (code map)
  • lm-eval-turboquant-k3v4nc (code map)
  • lm-eval-turboquant-k8v4 (code map)
  • lm-eval-turboquant-t3nc (code map)
  • lm-eval-turboquant-t4nc (code map)
  • lm-eval-watermarking (code map)
  • lora ×4 (code map)
  • lora-tp-distributed ×4 (code map)
  • metrics-tracing-2-gpus (code map)
  • model-executor (code map)
  • mooncake-ec-tcp-e2e-2-gpus (code map)
  • mrcr-eval-small-models (code map)
  • multi-modal-accuracy-eval-small-models (code map)
  • multi-modal-models-standard-1-qwen2 (code map)
  • multi-modal-models-standard-2-qwen3-gemma (code map)
  • multi-modal-models-standard-3-llava-qwen2-vl (code map)
  • multi-modal-models-standard-4-other-whisper (code map)
  • multi-modal-processor ×4 (code map)
  • multi-modal-processor-cpu ×4 (code map)
  • multiconnector-nixl-offloading-pd-accuracy-2-gpus (code map)
  • multiconnector-nixl-offloading-pd-edge-cases-2-gpus (code map)
  • nixlconnector-pd-edge-cases-2-gpus (code map)
  • openai-api-correctness (code map)
  • pipeline-context-parallelism-4-gpus (code map)
  • platform-tests (code map)
  • plugin-tests-2-gpus (code map)
  • push-nixlconnector-pp-prefill-pd-accuracy-4-gpus (code map)
  • pytorch-compilation-dynamic-shapes (code map)
  • pytorch-compilation-passes-unit-tests (code map)
  • pytorch-compilation-unit-tests (code map)
  • pytorch-compilation-unit-tests-h100 (code map)
  • pytorch-fullgraph-cudagraph-l4-compatibility (code map)
  • pytorch-fullgraph-test (code map)
  • pytorch-nightly-dependency-override-check (code map)
  • quantization ×4 (code map)
  • quantized-fusions (code map)
  • quantized-models-test (code map)
  • quantized-moe-test-b200 (code map)
  • qwen4-exp-unit-tests (code map)
  • qwen4-exp-unit-tests-cpu (code map)
  • ray-dependency-compatibility-check (code map)
  • rayexecutorv2-4-gpus (code map)
  • regression (code map)
  • replayssm-e2e (code map)
  • rl-entrypoints-tests (code map)
  • samplers-multimodal-beam-search (code map)
  • samplers-test (code map)
  • scale-out-ec-e2e-2-gpus (code map)
  • sharded-rdt-weight-transfer (code map)
  • spec-decode-draft-model ×4 (code map)
  • spec-decode-eagle-1-deepseek-qwen (code map)
  • spec-decode-eagle-2-llama3-qwen-vl-other (code map)
  • spec-decode-mtp-deepseek-mimo (code map)
  • spec-decode-mtp-gemma4 (code map)
  • spec-decode-mtp-qwen3-5 (code map)
  • spec-decode-ngram-suffix (code map)
  • spec-decode-speculators (code map)
  • torch-stable-abi-audit (code map)
  • v1-attention-b200 ×2 (code map)
  • v1-attention-h100-mi300 ×2 (code map)
  • v1-core (code map)
  • v1-executor-worker (code map)
  • v1-kv-connectors ×4 (code map)
  • v1-kv-offload (code map)
  • v1-logits-oracle (code map)
  • v1-metrics-lmeval (code map)
  • v1-others-cpu (code map)
  • v1-sample (code map)
  • v1-spec-decode (code map)
  • vllm-ir-tests (code map)
AMD mirrors: would skip (0)

none

AMD mirrors: would add (156)
  • async-engine-inputs-utils-worker (code map)
  • basic-correctness ×2 (code map)
  • basic-correctness-cpu-offload (code map)
  • basic-correctness-cumem (code map)
  • basic-correctness-prefetch-offload (code map)
  • basic-correctness-sleep-mode (code map)
  • basic-models-tests-extra-initialization ×14 (code map)
  • basic-models-tests-initialization (code map)
  • basic-models-tests-other (code map)
  • batch-invariance-h100 (code map)
  • benchmarks-cli-test (code map)
  • crosslayer-kv-layout-distributed-nixlconnector-pd-accuracy-tests-4-gpus (code map)
  • cudagraph (code map)
  • deepseek-v4-kernel-test-b200 (code map)
  • deepseek-v4-kernel-test-h100 (code map)
  • distributed-comm-ops (code map)
  • distributed-compile-comm-4-gpus (code map)
  • distributed-compile-rpc-tests-2-gpus (code map)
  • distributed-compile-unit-tests-2xh100 (code map)
  • distributed-dp-tests-2-gpus (code map)
  • distributed-dp-tests-4-gpus (code map)
  • distributed-flashinfer-nixlconnector-pd-accuracy-4-gpus (code map)
  • distributed-model-tests-2-gpus ×3 (code map)
  • distributed-mooncakeconnector-pd-accuracy-4-gpus (code map)
  • distributed-nixlconnector-pd-accuracy-4-gpus (code map)
  • distributed-tests-8xh100 (code map)
  • distributed-torchrun-examples-4-gpus (code map)
  • distributed-torchrun-shutdown-tests-2-gpus (code map)
  • docker-build-metadata (code map)
  • dp-ep-distributed-nixlconnector-pd-accuracy-tests-4-gpus (code map)
  • e2e-core-1-gpu (code map)
  • e2e-core-large-memory (code map)
  • e2e-scheduling-1-gpu (code map)
  • e2e-scheduling-accuracy-1-gpu (code map)
  • engine (code map)
  • engine-1-gpu (code map)
  • entrypoints-integration-api-server ×4 (code map)
  • entrypoints-integration-api-server-generate (code map)
  • entrypoints-integration-api-server-openai-chat_completion (code map)
  • entrypoints-integration-api-server-openai-completion (code map)
  • entrypoints-integration-llm (code map)
  • entrypoints-integration-multimodal (code map)
  • entrypoints-integration-pooling (code map)
  • entrypoints-integration-responses-api (code map)
  • entrypoints-integration-speech_to_text (code map)
  • entrypoints-unit-tests (code map)
  • eplb-algorithm (code map)
  • eplb-execution (code map)
  • examples (code map)
  • extract-hidden-states-integration (code map)
  • extract-hidden-states-integration-2-gpus (code map)
  • fault-tolerance-e2e-2xh100 (code map)
  • fusion-and-compile-unit-tests-2xb200 (code map)
  • fusion-e2e-config-sweep-h100 (code map)
  • fusion-e2e-quick-h100 (code map)
  • fusion-e2e-tp2-ar-rms-config-sweep-h100 (code map)
  • fusion-e2e-tp2-b200 (code map)
  • fusion-e2e-tp2-quick-h100 (code map)
  • gemm-rs-ar-2xb200 (code map)
  • glm5next-unit-tests (code map)
  • hybrid-ssm-nixlconnector-pd-accuracy-tests-4-gpus (code map)
  • hybrid-ssm-nixlconnector-pd-prefix-cache-2-gpus (code map)
  • inkling-unit-tests-b200 (code map)
  • jit-monitor-no-runtime-jit (code map)
  • kernels-attention-diffkv-test-h100 (code map)
  • kernels-attention-test ×7 (code map)
  • kernels-b200 ×3 (code map)
  • kernels-core-operation-test ×3 (code map)
  • kernels-fla-ops-test-b200 (code map)
  • kernels-flashmla-test-h100 (code map)
  • kernels-fp4-moe-test-b200 (code map)
  • kernels-fusedmoe-layer-test-2-b200s (code map)
  • kernels-fusedmoe-layer-test-2-h100s (code map)
  • kernels-helion-test ×5 (code map)
  • kernels-mamba-test (code map)
  • kernels-mhc-test-b200 (code map)
  • kernels-minimax-reduce-rms-test-2-gpus (code map)
  • kernels-moe-test ×5 (code map)
  • kernels-quantization-test ×6 (code map)
  • kernels-root-misc-test-b200 (code map)
  • kimi-k3-unit-tests-b200 (code map)
  • kv-offload-large (code map)
  • kv-offload-medium (code map)
  • kv-offload-small (code map)
  • language-models-tests-extra-standard ×2 (code map)
  • language-models-tests-granite-l4-compatibility (code map)
  • language-models-tests-hybrid ×2 (code map)
  • language-models-tests-standard (code map)
  • lm-eval-dspark-watermark-2xh100 (code map)
  • lm-eval-small-models (code map)
  • lm-eval-turboquant-k3v4nc (code map)
  • lm-eval-turboquant-k8v4 (code map)
  • lm-eval-turboquant-t3nc (code map)
  • lm-eval-turboquant-t4nc (code map)
  • lm-eval-watermarking (code map)
  • lora ×4 (code map)
  • lora-tp-distributed ×4 (code map)
  • metrics-tracing-2-gpus (code map)
  • model-executor (code map)
  • mooncake-ec-tcp-e2e-2-gpus (code map)
  • mrcr-eval-small-models (code map)
  • multi-modal-accuracy-eval-small-models (code map)
  • multi-modal-models-standard-1-qwen2 (code map)
  • multi-modal-models-standard-2-qwen3-gemma (code map)
  • multi-modal-models-standard-3-llava-qwen2-vl (code map)
  • multi-modal-models-standard-4-other-whisper (code map)
  • multi-modal-processor ×4 (code map)
  • multiconnector-nixl-offloading-pd-accuracy-2-gpus (code map)
  • multiconnector-nixl-offloading-pd-edge-cases-2-gpus (code map)
  • nixlconnector-pd-edge-cases-2-gpus (code map)
  • nixlconnector-pd-spec-decode-acceptance-2-gpus (code map)
  • openai-api-correctness (code map)
  • pipeline-context-parallelism-4-gpus (code map)
  • platform-tests (code map)
  • plugin-tests-2-gpus (code map)
  • push-nixlconnector-pp-prefill-pd-accuracy-4-gpus (code map)
  • pytorch-compilation-dynamic-shapes (code map)
  • pytorch-compilation-passes-unit-tests (code map)
  • pytorch-compilation-unit-tests (code map)
  • pytorch-compilation-unit-tests-h100 (code map)
  • pytorch-fullgraph-cudagraph-l4-compatibility (code map)
  • pytorch-fullgraph-test (code map)
  • pytorch-nightly-dependency-override-check (code map)
  • quantization ×4 (code map)
  • quantized-fusions (code map)
  • quantized-models-test (code map)
  • quantized-moe-test-b200 (code map)
  • qwen4-exp-unit-tests (code map)
  • ray-dependency-compatibility-check (code map)
  • rayexecutorv2-4-gpus (code map)
  • regression (code map)
  • rl-entrypoints-tests (code map)
  • samplers-multimodal-beam-search (code map)
  • samplers-test (code map)
  • scale-out-ec-e2e-2-gpus (code map)
  • sharded-rdt-weight-transfer (code map)
  • spec-decode-draft-model ×4 (code map)
  • spec-decode-eagle-1-deepseek-qwen (code map)
  • spec-decode-eagle-2-llama3-qwen-vl-other (code map)
  • spec-decode-mtp-deepseek-mimo (code map)
  • spec-decode-mtp-gemma4 (code map)
  • spec-decode-mtp-qwen3-5 (code map)
  • spec-decode-ngram-suffix (code map)
  • spec-decode-speculators (code map)
  • torch-stable-abi-audit (code map)
  • v1-attention-b200 ×2 (code map)
  • v1-attention-h100-mi300 ×2 (code map)
  • v1-core (code map)
  • v1-executor-worker (code map)
  • v1-kv-connectors ×4 (code map)
  • v1-kv-offload (code map)
  • v1-logits-oracle (code map)
  • v1-metrics-lmeval (code map)
  • v1-sample (code map)
  • v1-spec-decode (code map)
  • vllm-ir-tests (code map)

8 changed files · base b89852aad0 · head 0b9ec81e9f · Python record: build 93039 at 1e5d0ea888 · kernel record: table f26d9f4 (build 94096), map f26d9f4 · not counted: 11 build steps, 5 A100 steps the generator no longer emits, 136 optional steps the selector would also run

Base automatically changed from bz/tool-schema-view to main October 7, 2026 08:28
@BugenZhao
BugenZhao force-pushed the bz/k3-full-output-grammar branch from 8392a1b to 4583c7f Compare October 7, 2026 16:00
@mergify mergify Bot removed the needs-rebase label Oct 7, 2026
@BugenZhao
BugenZhao marked this pull request as ready for review October 8, 2026 09:02
@BugenZhao
BugenZhao requested a review from njhill as a code owner October 8, 2026 09:02

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@BugenZhao

Copy link
Copy Markdown
Member Author

/ci run --allow-stale

@BugenZhao BugenZhao added the ready ONLY add when PR is ready to merge/full CI is needed label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #93558 for commit 2de412c6833a.

⚠️ This PR is 58 commits behind upstream main. Running CI at your own risk because --allow-stale was requested; outdated CI configuration may cause failures. Before merging, merge or rebase onto the latest main, then rerun /ci run on the latest PR commit.

BugenZhao and others added 3 commits October 9, 2026 04:38
… mode

Kimi K3 grammars only covered the output after reasoning, through a
structural-tag builder whose `reasoning` option stood for both the
request's thinking mode and the grammar's start. Build the whole
generation from the parser's initialized mode instead, so the engine
constrains it from token zero:

- a prompt-opened `think` or `response` channel continues its body,
  and a prompt that opened no channel may emit a `think` channel;
- after `think`, `auto` needs a response, tools, or both, while
  `required` and named choices need tools, optionally after a response;
- named choices and `parallel_tool_calls=false` allow one call.

Tools may now follow reasoning directly, which the builder rejected.
Remove `KimiK3StructuralTagBuilder`; its call tag and XTML argument
syntax move into the new grammar module. Tool-choice normalization for
model-owned grammars lives in `output_grammar`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
`xgrammar-structural-tag` 0.4.1 exposes the tool-choice normalization
that `build_structural_tag` applies before calling a builder. Use it for
model-owned grammars instead of the local copy, which only covered
`auto`, `required`, and named choices and missed the crate's validation
and allowed-tools handling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Render the K3 topology snapshots with `output_grammar::test_utils::outline`
instead of a K3-only one-line renderer. Call bodies are elided to `..`
first, since the argument tests cover them, so the snapshots show the
channel structure with its real markers, text exclusions, and call
repetition options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@njhill

njhill commented Oct 9, 2026

Copy link
Copy Markdown
Member

/ci run

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

❌ This PR is 57 commits behind upstream main. Your branch must contain every commit currently on upstream main. No new CI build was started. Merge or rebase onto the latest main, then rerun /ci run. To test this branch at your own risk, use /ci run --allow-stale.

@njhill

njhill commented Oct 9, 2026

Copy link
Copy Markdown
Member

/ci run --allow-stale

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #93919 for commit 028a54dc189a.

⚠️ This PR is 58 commits behind upstream main. Running CI at your own risk because --allow-stale was requested; outdated CI configuration may cause failures. Before merging, merge or rebase onto the latest main, then rerun /ci run on the latest PR commit.

@BugenZhao

Copy link
Copy Markdown
Member Author

/ci run --allow-stale

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #94139 for commit 0b9ec81e9f55.

⚠️ This PR is 29 commits behind upstream main. Running CI at your own risk because --allow-stale was requested; outdated CI configuration may cause failures. Before merging, merge or rebase onto the latest main, then rerun /ci run on the latest PR commit.

@BugenZhao
BugenZhao merged commit 0466bd3 into main Oct 12, 2026
35 checks passed
@BugenZhao
BugenZhao deleted the bz/k3-full-output-grammar branch October 12, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

k3 kimi ready ONLY add when PR is ready to merge/full CI is needed rust

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants