Skip to content

[None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths - #21616

Merged
yizhang-nv merged 5 commits into
NVIDIA:feat/mistral-large-4from
yizhang-nv:codex/ml4-mergeback-defensive-cleanup
Nov 4, 2026
Merged

yizhang-nv merged 5 commits into
NVIDIA:feat/mistral-large-4from
yizhang-nv:codex/ml4-mergeback-defensive-cleanup

Conversation

@yizhang-nv

Copy link
Copy Markdown
Member

@coderabbitai summary

Summary

Part of merging Mistral Large 4 back into main. This PR removes defensive code that Mistral Large 4 support (fece87edc4) added, and code that only served paths removed earlier: the FP8 target and mistral-common releases before 1.13.0. It reduces how much Mistral Large 4 code runs in shared files.

Base: feat/mistral-large-4 at bed375052a (#21548). The modeling_v2 targets do not change; outside routing.serves_images, everything is runtime code. Five commits, each with its rationale in the commit message:

  1. Require mistral-common 1.13.0 and drop the older-release fallbacks. One version check in checkpoints/mistral/config_loader.py, where a Mistral Large 4 params.json is recognized. LLM initialization reaches that point (ModelLoader._update_from_hf_quant_config) before it loads the tokenizer. The check raises ImportError: Mistral-Large-4 requires mistral-common>=1.13.0 (Python 3.11 or later); the installed version is X. Removed:

    • the MistralTokenizer.from_pretrained ValidationError fallback, which rewrote tekken.json into a temporary directory, together with its __reduce__ branch and its reasoning-effort message;
    • the JsonSchema ImportError fallback in _native_mistral_response_format.

    The Tekken __reduce__ fix stays. requirements.txt is unchanged: Python 3.10 keeps mistral-common>=1.10.0 and now gets this error for Mistral Large 4.

  2. Drop what the removed FP8 target left behind.

    • MistralNativeInputProcessor._serves_images/_check_images_served, which also removes the V1 → modeling_v2 routing import.
    • routing.serves_images is now just vision_config is not None.
    • adapt_config_dict no longer refuses a params.json quantization block.
  3. Check each chat request rule once.

    • The native renderer no longer rejects chat_template. The serving extension still returns 400 for a request-level chat_template.
    • The extension no longer checks reasoning-effort names; mistral-common checks them at render time and the result is HTTP 400. The check that the two places a reasoning effort can be given agree stays.
  4. Drop checks that routing or the callers already guarantee.

    • MistralLarge4CacheManager: the structural checks become one assert, and the redundant use_fp8_ds_mla = False is removed.
    • Config loader: the sharing-length check and the DSpark layer-order check are removed.
    • DSpark: the raise for a recurrent head without hidden states is removed.
    • RankState.deserialize no longer accepts payloads without the spec-decoding fields.
    • The "owns no KEY buffer" raises in KVCacheManagerV2.get_layer_page_index_scale and DSACacheManagerV2.get_primary_pool_page_index_params are removed.
    • The image count invariants in _native_mistral_messages are removed.
    • lm_eval no longer re-validates the token ids it produced itself.
  5. State fp8_kv_cache as the ModelOpt KV-cache algorithm (D3). The native config adapter writes kv_cache_quant_algo: FP8 into the checkpoint's quantization_config (unless it already states one). The Mistral Large 4 branches in ModelConfig.from_pretrained and ModelLoader._update_from_hf_quant_config are removed. This commit is kept separate so it can be dropped on its own.

Kept on purpose (they looked like duplicates, but are not):

  • openai_server sets a server-level --chat_template aside for this format and warns. The extension only sees the request field.
  • BaseLLM._try_load_tokenizer selects mistral-common for checkpoint_format="mistral_large_4". Without it, a directory that also ships config.json + tokenizer.json would get the HF tokenizer, which breaks the one-switch rule (test_the_native_format_loads_mistral_common_even_beside_a_config).
  • ChatCompletionRequest still rejects continue_final_message together with add_generation_prompt. It covers every model, and the DeepSeek V3.2/V4/V4.1 native renderers ignore continue_final_message. Without the check, those models would silently open a new assistant turn.
  • BaseLLM still skips generation_config.json for this format, because the final checkpoint ships one.
  • The cache manager's dtype and pool-rebalance checks stay; moving them is a separate change.

What users see differently:

  • A params.json with the FP8 export's quantization block now fails when the model is built, not when the config loads. With modeling_v2="require" the error is: no target fits 'MistralLarge4ForCausalLM': ... quantization differs; the mistral_large4 targets are Mistral-Large-4-1T-A52B-NVFP4 (ModelOpt MIXED_PRECISION ...).
  • An unknown effort name in chat_template_kwargs (for example turbo) still gets HTTP 400, now with mistral-common's validation message instead of the extension's. An effort the checkpoint does not declare is rejected as before; for none the message is reasoning_effort should be one of ['low', 'medium', 'high'], got none.

Validation

Environment: one B200 node (umbriel-b200-034), dev container, CPU only (CUDA_VISIBLE_DEVICES=), mistral-common 1.13.1 and llguidance 1.7.6 from PyPI. The same commands ran on bed375052a and on this branch.

L0 (frontend CPU tests, run with pytest -m cpu_only):

set bed375052a this branch
ML4 group: modeling_v2/models/mistral_large4, models/checkpoints, test_model_config.py, test_modeling_v2_{routing,claims}.py 1201 passed, 481 skipped 1195 passed, 483 skipped
L0 frontend + affected runtime, MISTRAL_LARGE4_CHECKPOINT_DIR = final checkpoint (v3) metadata 2021 passed, 24 skipped 2004 passed, 24 skipped
same, an earlier v15 checkpoint (v2) metadata 2017 passed, 24 skipped, 4 failed 2000 passed, 24 skipped, 4 failed (the same 4)
  • The L0 set covers native chat template, guided decoding, parsers, scope, DSpark, multimodal processor, collapsed image tokens, tokenizer factory, custom tokenizer aliases, serving extensions, chat utils, tool parsers, KV-dtype override, lm_eval, bench, the ML4 and DSA cache managers, the ADP router and iteration stats, and KVCM V2 integration.
  • Per-test comparison (junit): no test that exists in both runs changed outcome.
    • The removed tests are the ones that tested only the removed checks.
    • One test is now parametrized three ways; without a checkpoint directory, those three cases account for the two extra skips in the first row.
  • The 4 v2 failures fail identically on bed375052a. Those tests hard-code reasoning_effort="low", which the earlier checkpoint does not declare. This PR does not change them.
  • No HF-lite case exists in the repo yet.
  • A CPU behavior record (real v3 tekken.json/params.json, openai_chat through FastAPI's TestClient), compared before and after:
    • KV resolution: ModelConfig and llm.args resolve the same kv_cache_quant_algo and select the same cache manager (MistralLarge4CacheManager) for KV dtype auto/fp8/fp8_ds_mla/nvfp4, and reject bf16 the same way. Routing picks the same target.
    • Commit 5 has one difference: with auto, the per-module QuantConfigs of the MIXED_PRECISION map now carry FP8, as they already did with an explicit fp8. Nothing reads them.
    • HTTP: every request gets the same status code as before. This covers efforts unset/low/none/max/minimal/unknown/conflicting, request chat_template, continuation flags, and json_object.
  • pre-commit run --files on every changed file: passed.

Not run, so INCONCLUSIVE until run:

  • L1/L2 (GB300, sm_103). Runtime paths that need L1:
    • commit 4: cache manager, DSpark worker, rank_state, kv_cache_manager_v2 / DSA cache manager, the native image path;
    • commit 5: KV-cache algorithm resolution on the real engine.
  • The GPU unit test test_mistral_large4_cache_layout.py changed (sharer layers now expect None page-index params). It was only collected, not run.

Deviations from the workflow

  • Runtime changes outside modeling_v2, per commit:

    1. _torch/models/checkpoints/mistral/config_loader.py, _torch/models/checkpoints/mistral/tokenizer.py, inputs/utils.py
    2. _torch/models/checkpoints/mistral/config_loader.py, _torch/models/modeling_mistral.py (plus modeling_v2/models/mistral_large4/routing.py inside modeling_v2)
    3. inputs/utils.py, serve/extensions/mistral_large_4.py
    4. _torch/attention/backends/sparse/dsa/cache_manager.py, _torch/attention/backends/sparse/mistral_large4/cache_manager.py, _torch/models/checkpoints/mistral/config_loader.py, _torch/pyexecutor/kv_cache/kv_cache_manager_v2.py, _torch/pyexecutor/scheduler/rank_state.py, _torch/speculative/dspark.py, evaluate/lm_eval.py, inputs/utils.py
    5. _torch/model_config.py, _torch/models/checkpoints/mistral/config_loader.py, llmapi/llm_utils.py
  • Shared files that other models run through:

    • KVCacheManagerV2.get_layer_page_index_scale is back to its main form.
    • DSACacheManagerV2.get_primary_pool_page_index_params returns None instead of raising; only Mistral Large 4 managers have layers without a KEY buffer.
    • RankState.deserialize still reads payloads without the forward-work counters, as on main.
    • model_config.py and llm_utils.py only lose Mistral Large 4 branches.

    No other model's behavior changes, and no other target's gates were re-run.

  • Commit messages cite the internal development history by SHA, because fece87edc4 squashed it.

  • GitHub only, per the merge-back task; the internal GitLab is not used.

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

🤖 Generated with Claude Code

… the older-release fallbacks

Mistral Large 4 needs mistral-common 1.13.0 (requirements.txt pins it for
Python 3.11 and later). Check the installed version once, where the native
config loader recognizes a Mistral Large 4 params.json, and raise an
ImportError naming the required release. LLM initialization reads that
config (ModelLoader._update_from_hf_quant_config) before it loads the
tokenizer, so the check runs before any tekken.json is parsed.

Remove the fallbacks that kept older releases working:
- MistralTokenizer.from_pretrained no longer catches the pydantic
  ValidationError of a mistral-common without json_schema model settings,
  rewrites tekken.json into a temporary directory, or names the release
  for unknown reasoning efforts; __reduce__ loses its branch for that
  temporary copy. Added with Mistral Large 4 support (fece87e; internal
  history e899203965 and 3614ff7d23). The version check above replaces
  the reasoning-effort message.
- _native_mistral_response_format imports JsonSchema directly instead of
  rendering without the response format when it is missing (internal
  history 47b02da413, for mistral-common 1.12.0).

The tests that exercised only those fallbacks are removed, and the
JsonSchema rendering test no longer skips. A CPU test covers the version
check. requirements.txt keeps mistral-common>=1.10.0 on Python 3.10, which
cannot load Mistral Large 4 and now gets the error above.

A pre-release build also labelled 1.13.0 (c8cda03c) passes the check and
still fails on the final checkpoint's tekken.json with a ValidationError;
that environment issue is documented separately.

Signed-off-by: Yi Zhang <[email protected]>
…behind

Mistral Large 4 is served from the NVFP4 (ModelOpt MIXED_PRECISION) export
only; the FP8 target was removed before this branch was created (internal
history 87b26816af). Three pieces existed only for that target:

- MistralNativeInputProcessor asked modeling_v2 routing whether the
  checkpoint's target encodes images and refused images otherwise
  (_serves_images, _check_images_served; internal history b6c67e5b2b).
  Every routed target is NVFP4 and encodes images, and the processor is
  only built for a checkpoint with a vision encoder, so the check never
  refuses anything; the runtime no longer imports modeling_v2 routing.
- routing.serves_images also required the NVFP4 export. route() rejects
  any other quantization, so serves_images is now whether the config has
  a vision encoder.
- adapt_config_dict refused a params.json `quantization` block (the FP8
  export's format) for Mistral Large 4. Without it, such a checkpoint
  loads its config and is rejected where every other unsupported
  deployment is, when the model is built: with modeling_v2="require",
  "no target fits 'MistralLarge4ForCausalLM': ... quantization differs;
  the mistral_large4 targets are Mistral-Large-4-1T-A52B-NVFP4 (ModelOpt
  MIXED_PRECISION ...)". The other Mistral-native formats keep their
  mapping of that block.

The tests of the removed checks go with them.

Signed-off-by: Yi Zhang <[email protected]>
Mistral Large 4 support (fece87e) checked some chat request rules in
more than one place. Keep one check per rule:

- A request chat_template: the mistral_large_4 serving extension rejects
  it (HTTP 400) before rendering, and the server sets its own chat
  template aside for this format, so the native renderer in
  inputs/utils.apply_chat_template no longer rejects a chat_template
  (internal history e899203965). The server-level handling in
  openai_server stays: the extension sees only the request field.
- Reasoning effort names: mistral-common validates the effort against
  the checkpoint's tekken.json when the chat renders, and the renderer
  turns its errors into ValueError (HTTP 400). The extension keeps only
  the check that a top-level reasoning_effort and
  chat_template_kwargs['reasoning_effort'] agree, and no longer compares
  the name with mistral-common's ReasoningEffort (internal history
  d30f426cd4, 3614ff7d23). An effort the final checkpoint does not
  declare, such as "none", is still a 400.

The ChatCompletionRequest check that continue_final_message and
add_generation_prompt are not both set stays: it covers every model, and
the native renderers of other models (DeepSeek V3.2/V4/V4.1) ignore
continue_final_message, so without it such a request would silently open
a new assistant turn.

Unknown efforts are asserted where they are now rejected, and the
renderer's chat_template test is removed.

Signed-off-by: Yi Zhang <[email protected]>
…s already guarantee

modeling_v2 routing admits exactly one Mistral Large 4 layer structure and
DSpark geometry, and the engine builds the model (and its cache manager)
only after a target is routed. Several checks added with Mistral Large 4
support (fece87e) repeat what routing has already matched, or guard
inputs their only callers never produce:

- MistralLarge4CacheManager: the kv_source_layers validation, pp_size 1,
  num_layers, the SELFKONLY single-head latent, head_dim 512+64 and the
  indexer K-cache on every latent-sharing layer become one assert of the
  routed structure. The redundant `use_fp8_ds_mla = False` goes: the base
  class already sets it False because the manager hands it the "fp8"
  dtype. The dtype and pool-rebalance checks stay. (internal history
  950911b13e, 696ed7fecc)
- The native config loader no longer checks that kv_sharing and
  index_sharing have one entry per layer, or that the DSpark
  target_activation_layers are unique and ascending: routing matches both
  lists exactly ([1, 18, 36, 54, 71] for DSpark). (internal history
  e899203965, 4932efdc24)
- DSparkWorker._apply_dspark_markov_bias no longer raises when a recurrent
  head gets no draft hidden states: its only caller always passes them.
  (internal history 4932efdc24)
- RankState.deserialize no longer reads attention-DP payloads without the
  speculative-decoding fields: every rank runs the same build and
  serializes them. Payloads without the forward-work counters are still
  read, as before Mistral Large 4 support.
- KVCacheManagerV2.get_layer_page_index_scale and
  DSACacheManagerV2.get_primary_pool_page_index_params no longer raise for
  a layer that owns no KEY buffer; the generic callers skip such layers
  and the Mistral Large 4 targets only address owner layers. The latter
  returns None for such a layer. (internal history 696ed7fecc)
- _native_mistral_messages keeps its image-only check on the request's
  media and drops the per-part repeat of it, along with the image count
  invariants that the chat parser's per-message counts already ensure.
  (internal history e899203965)
- LmEvalWrapper no longer validates the token ids it serialized itself.
  (internal history e899203965)

The tests of the removed checks go with them; the cache layout test now
expects None for a sharer layer's page-index params.

Signed-off-by: Yi Zhang <[email protected]>
…cache algorithm

A Mistral Large 4 params.json states its FP8 latent cache as
dsa.fp8_kv_cache rather than as a kv_cache_quant_algo. ModelConfig and
ModelLoader._update_from_hf_quant_config each mapped it with a branch on
the architecture or checkpoint format (fece87e).

The native config adapter now writes it into the checkpoint's ModelOpt
quantization_config as kv_cache_quant_algo FP8 (unless that config
already states one), and both generic readers take it from there like any
other ModelOpt checkpoint. Neither keeps a Mistral Large 4 branch.

Unchanged: kv_cache_config.dtype "auto" keeps FP8 and an explicit dtype
overrides it; ModelConfig and llm.args report the same
kv_cache_quant_algo for auto, fp8, fp8_ds_mla and nvfp4; routing still
reads fp8_kv_cache; the cache manager is still MistralLarge4CacheManager.
The per-module QuantConfigs of the MIXED_PRECISION map now also carry FP8
with dtype "auto", as they already did with an explicit "fp8"; nothing
reads their KV-cache algorithm.

This change is kept separate so that it can be reverted on its own.

Signed-off-by: Yi Zhang <[email protected]>
@yizhang-nv
yizhang-nv marked this pull request as ready for review November 4, 2026 08:51
@yizhang-nv
yizhang-nv merged commit 3fb4be0 into NVIDIA:feat/mistral-large-4 Nov 4, 2026
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 8, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0),
applied on main 19c1f46:

- fece87e [None][feat] Add Mistral Large 4 support
- 9df1a00 [None][fix] Keep requirements installable on Python 3.10
- 5f00308 [None][doc] Mistral Large 4: install from the release container
  or wheel (NVIDIA#21425)
- bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight
  loader and mapper (NVIDIA#21548)
- 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and
  leftovers of removed paths (NVIDIA#21616)

Not carried: the six infra commits already on main (NVIDIA#21133, NVIDIA#19557,
(cf7ae79, 1.4.0a0).

Adapted to main:

- modeling_v2 routing: the family registers its route with
  @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it;
  route takes (model_config, llm_args, compute_capability). The routing
  tests use main's per-family sm_103 fixture; the engine-config tests
  record the route through registered_routes and resolve on one rank.
- thop_attention call sites use main's argument names (workspace,
  spec_decoding_position_offsets); top_k kernels come from
  _torch/kernels/blackwell/top_k.
- Catalog: the targets' cells move into each op test's TARGET_CELLS
  (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps
  main's op.
- DSpark/DFlash: the native drafter's hooks sit on main's refactored
  worker (block placement, vocab-parallel drafting, Markov TP exchange);
  the recurrent Markov head takes its hidden states directly and the
  fused paged-latent path is not taken for drafters with their own block
  embedding.
- Per-rank spec-decoding stats travel in main's versioned rank-state
  frame (version -2 adds a spec snapshot); KVCacheManagerV2 keeps
  has_buffer next to main's mixed-precision get_buffers.
- Serving: the chat path runs on main's prompt pipeline and
  ServingExtension hooks; Mistral Large 4 adds render_needs_media,
  forced_tool_call_decoding ("native" required-tool mode) and
  validate_chat_request. `store` follows main (accepted and ignored).
- Warmup/ADP dummies keep the joint-KV-reuse draft allocation on main's
  dummy request arguments.
- Tests follow main's engine/runner refactor (ModelEngine,
  filter_prefill_capture_num_tokens, removed validate_feature_combination),
  main's scoped reference precision (true_fp32_matmul) and scoped engine
  environments (scoped_env_overrides).
- Dependencies: flashinfer-python 0.7.2 and xgrammar 0.2.8 from main;
  llguidance 1.7.6 and mistral-common>=1.13.0 (Python >= 3.11) from the
  feature branch.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 12, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0),
applied on main 19c1f46:

- fece87e [None][feat] Add Mistral Large 4 support
- 9df1a00 [None][fix] Keep requirements installable on Python 3.10
- 5f00308 [None][doc] Mistral Large 4: install from the release container
  or wheel (NVIDIA#21425)
- bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight
  loader and mapper (NVIDIA#21548)
- 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and
  leftovers of removed paths (NVIDIA#21616)

Not carried: the six infra commits already on main (NVIDIA#21133, NVIDIA#19557,
(cf7ae79, 1.4.0a0).

Adapted to main:

- modeling_v2 routing: the family registers its route with
  @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it;
  route takes (model_config, llm_args, compute_capability). The routing
  tests use main's per-family sm_103 fixture; the engine-config tests
  record the route through registered_routes and resolve on one rank.
- thop_attention call sites use main's argument names (workspace,
  spec_decoding_position_offsets); top_k kernels come from
  _torch/kernels/blackwell/top_k.
- Catalog: the targets' cells move into each op test's TARGET_CELLS
  (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps
  main's op.
- DSpark/DFlash: the native drafter's hooks sit on main's refactored
  worker (block placement, vocab-parallel drafting, Markov TP exchange);
  the recurrent Markov head takes its hidden states directly and the
  fused paged-latent path is not taken for drafters with their own block
  embedding.
- Per-rank spec-decoding stats travel in main's versioned rank-state
  frame (version -2 adds a spec snapshot); KVCacheManagerV2 keeps
  has_buffer next to main's mixed-precision get_buffers.
- Serving: the chat path runs on main's prompt pipeline and
  ServingExtension hooks; Mistral Large 4 adds render_needs_media,
  forced_tool_call_decoding ("native" required-tool mode) and
  validate_chat_request. `store` follows main (accepted and ignored).
- Warmup/ADP dummies keep the joint-KV-reuse draft allocation on main's
  dummy request arguments.
- Tests follow main's engine/runner refactor (ModelEngine,
  filter_prefill_capture_num_tokens, removed validate_feature_combination),
  main's scoped reference precision (true_fp32_matmul) and scoped engine
  environments (scoped_env_overrides).
- Dependencies: flashinfer-python 0.7.2 and xgrammar 0.2.8 from main;
  llguidance 1.7.6 and mistral-common>=1.13.0 (Python >= 3.11) from the
  feature branch.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 13, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0),
applied on main 19c1f46:

- fece87e [None][feat] Add Mistral Large 4 support
- 9df1a00 [None][fix] Keep requirements installable on Python 3.10
- 5f00308 [None][doc] Mistral Large 4: install from the release container
  or wheel (NVIDIA#21425)
- bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight
  loader and mapper (NVIDIA#21548)
- 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and
  leftovers of removed paths (NVIDIA#21616)

Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL
release, attention-DP dummy paired draft KV, context warmup beside a
capturable guided decoder, per-rank spec-decoding stats), and the six
infra commits already on main (NVIDIA#21133, NVIDIA#19557,
(cf7ae79, 1.4.0a0).

Adapted to main:

- modeling_v2 routing: the family registers its route with
  @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it;
  route takes (model_config, llm_args, compute_capability). The routing
  tests use main's per-family sm_103 fixture; the engine-config tests
  record the route through registered_routes and resolve on one rank.
- thop_attention call sites use main's argument names (workspace,
  spec_decoding_position_offsets); top_k kernels come from
  _torch/kernels/blackwell/top_k.
- Catalog: the targets' cells move into each op test's TARGET_CELLS
  (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps
  main's op.
- DSpark/DFlash: the native drafter's hooks sit on main's refactored
  worker (block placement, vocab-parallel drafting, Markov TP exchange);
  the recurrent Markov head takes its hidden states directly and the
  fused paged-latent path is not taken for drafters with their own block
  embedding.
- KVCacheManagerV2 keeps has_buffer next to main's mixed-precision
  get_buffers.
- Serving: the chat path runs on main's prompt pipeline and
  ServingExtension hooks; Mistral Large 4 adds render_needs_media,
  forced_tool_call_decoding ("native" required-tool mode) and
  validate_chat_request. `store` follows main (accepted and ignored).
- Tests follow main's engine/runner refactor (ModelEngine,
  filter_prefill_capture_num_tokens, removed validate_feature_combination),
  main's scoped reference precision (true_fp32_matmul) and scoped engine
  environments (scoped_env_overrides).
- Dependencies: flashinfer-python 0.7.2 and xgrammar 0.2.8 from main;
  llguidance 1.7.6 and mistral-common>=1.13.0 (Python >= 3.11) from the
  feature branch.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 17, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0),
applied on main (first 19c1f46, now 3705333 with NVIDIA#22185):

- fece87e [None][feat] Add Mistral Large 4 support
- 9df1a00 [None][fix] Keep requirements installable on Python 3.10
- 5f00308 [None][doc] Mistral Large 4: install from the release container
  or wheel (NVIDIA#21425)
- bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight
  loader and mapper (NVIDIA#21548)
- 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and
  leftovers of removed paths (NVIDIA#21616)

Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL
release, attention-DP dummy paired draft KV, context warmup beside a
capturable guided decoder, per-rank spec-decoding stats), and the six
infra commits already on main (NVIDIA#21133, NVIDIA#19557,
(cf7ae79, 1.4.0a0).

Adapted to main:

- modeling_v2 routing: the family registers its route with
  @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it;
  route takes (model_config, llm_args, compute_capability). The routing
  tests use main's per-family sm_103 fixture; the engine-config tests
  record the route through registered_routes and resolve on one rank.
- thop_attention call sites use main's argument names (workspace,
  spec_decoding_position_offsets); top_k kernels come from
  _torch/kernels/blackwell/top_k.
- Catalog: the targets' cells move into each op test's TARGET_CELLS
  (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps
  main's op.
- DSpark/DFlash: the native drafter's hooks sit on main's refactored
  worker (block placement, vocab-parallel drafting, Markov TP exchange);
  the recurrent Markov head takes its hidden states directly and the
  fused paged-latent path is not taken for drafters with their own block
  embedding.
- KVCacheManagerV2 keeps has_buffer next to main's mixed-precision
  get_buffers.
- Serving: the chat path runs on main's prompt pipeline and
  ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding
  ("native" required-tool mode) and validate_chat_request. `store` follows
  main (accepted and ignored).
- Tests follow main's engine/runner refactor (ModelEngine,
  filter_prefill_capture_num_tokens, removed validate_feature_combination),
  main's scoped reference precision (true_fp32_matmul) and scoped engine
  environments (scoped_env_overrides).
- Dependencies: flashinfer-python and xgrammar from main; llguidance and
  mistral-common from NVIDIA#22185.

Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that
selection, the xgrammar and llguidance Tekken tokenizers, mistral-common
chat rendering with images and the mistral_native serving extension, the
KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and
passing history tool-call arguments to mistral-common as sent. On top of it,
Mistral Large 4 keeps:

- its model type among the native Mistral model types, with its
  placeholder metadata;
- MistralLarge4ServingExtension as a subclass of the Mistral-native one
  (which now registers for mistral_common only), adding the output-budget
  check, the forced tool-call grammar and the raw structured-output grammar;
- the llguidance JSON grammar that may open with a [THINK] section and the
  tool-call grammar, from mistral-common's grammar factory;
- a Mistral Large 4 prompt's token ids with one [IMG] per image expanded
  to the image grids (other checkpoints keep NVIDIA#22185's check);
- lm-eval's native chat token ids and scoring on the reasoning parser's
  content, and mistral-style tool-call ids.

The feature branch's own copies of these paths, its native_chat processor
branch and its coercion of malformed history tool-call arguments are
dropped.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 20, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0),
applied on main (first 19c1f46, now 3705333 with NVIDIA#22185):

- fece87e [None][feat] Add Mistral Large 4 support
- 9df1a00 [None][fix] Keep requirements installable on Python 3.10
- 5f00308 [None][doc] Mistral Large 4: install from the release container
  or wheel (NVIDIA#21425)
- bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight
  loader and mapper (NVIDIA#21548)
- 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and
  leftovers of removed paths (NVIDIA#21616)

Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL
release, attention-DP dummy paired draft KV, context warmup beside a
capturable guided decoder, per-rank spec-decoding stats), and the six
infra commits already on main (NVIDIA#21133, NVIDIA#19557,
(cf7ae79, 1.4.0a0).

Adapted to main:

- modeling_v2 routing: the family registers its route with
  @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it;
  route takes (model_config, llm_args, compute_capability). The routing
  tests use main's per-family sm_103 fixture; the engine-config tests
  record the route through registered_routes and resolve on one rank.
- thop_attention call sites use main's argument names (workspace,
  spec_decoding_position_offsets); top_k kernels come from
  _torch/kernels/blackwell/top_k.
- Catalog: the targets' cells move into each op test's TARGET_CELLS
  (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps
  main's op.
- DSpark/DFlash: the native drafter's hooks sit on main's refactored
  worker (block placement, vocab-parallel drafting, Markov TP exchange);
  the recurrent Markov head takes its hidden states directly and the
  fused paged-latent path is not taken for drafters with their own block
  embedding.
- KVCacheManagerV2 keeps has_buffer next to main's mixed-precision
  get_buffers.
- Serving: the chat path runs on main's prompt pipeline and
  ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding
  ("native" required-tool mode) and validate_chat_request. `store` follows
  main (accepted and ignored).
- Tests follow main's engine/runner refactor (ModelEngine,
  filter_prefill_capture_num_tokens, removed validate_feature_combination),
  main's scoped reference precision (true_fp32_matmul) and scoped engine
  environments (scoped_env_overrides).
- Dependencies: flashinfer-python and xgrammar from main; llguidance and
  mistral-common from NVIDIA#22185.

Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that
selection, the xgrammar and llguidance Tekken tokenizers, mistral-common
chat rendering with images and the mistral_native serving extension, the
KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and
passing history tool-call arguments to mistral-common as sent. On top of it,
Mistral Large 4 keeps:

- its model type among the native Mistral model types, with its
  placeholder metadata;
- MistralLarge4ServingExtension as a subclass of the Mistral-native one
  (which now registers for mistral_common only), adding the output-budget
  check, the forced tool-call grammar and the raw structured-output grammar;
- the llguidance JSON grammar that may open with a [THINK] section and the
  tool-call grammar, from mistral-common's grammar factory;
- a Mistral Large 4 prompt's token ids with one [IMG] per image expanded
  to the image grids (other checkpoints keep NVIDIA#22185's check);
- lm-eval's native chat token ids and scoring on the reasoning parser's
  content, and mistral-style tool-call ids.

The feature branch's own copies of these paths, its native_chat processor
branch and its coercion of malformed history tool-call arguments are
dropped.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 23, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0),
applied on main (first 19c1f46, now 3705333 with NVIDIA#22185):

- fece87e [None][feat] Add Mistral Large 4 support
- 9df1a00 [None][fix] Keep requirements installable on Python 3.10
- 5f00308 [None][doc] Mistral Large 4: install from the release container
  or wheel (NVIDIA#21425)
- bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight
  loader and mapper (NVIDIA#21548)
- 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and
  leftovers of removed paths (NVIDIA#21616)

Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL
release, attention-DP dummy paired draft KV, context warmup beside a
capturable guided decoder, per-rank spec-decoding stats), and the six
infra commits already on main (NVIDIA#21133, NVIDIA#19557,
(cf7ae79, 1.4.0a0).

Adapted to main:

- modeling_v2 routing: the family registers its route with
  @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it;
  route takes (model_config, llm_args, compute_capability). The routing
  tests use main's per-family sm_103 fixture; the engine-config tests
  record the route through registered_routes and resolve on one rank.
- thop_attention call sites use main's argument names (workspace,
  spec_decoding_position_offsets); top_k kernels come from
  _torch/kernels/blackwell/top_k.
- Catalog: the targets' cells move into each op test's TARGET_CELLS
  (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps
  main's op.
- DSpark/DFlash: the native drafter's hooks sit on main's refactored
  worker (block placement, vocab-parallel drafting, Markov TP exchange);
  the recurrent Markov head takes its hidden states directly and the
  fused paged-latent path is not taken for drafters with their own block
  embedding.
- KVCacheManagerV2 keeps has_buffer next to main's mixed-precision
  get_buffers.
- Serving: the chat path runs on main's prompt pipeline and
  ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding
  ("native" required-tool mode) and validate_chat_request. `store` follows
  main (accepted and ignored).
- Tests follow main's engine/runner refactor (ModelEngine,
  filter_prefill_capture_num_tokens, removed validate_feature_combination),
  main's scoped reference precision (true_fp32_matmul) and scoped engine
  environments (scoped_env_overrides).
- Dependencies: flashinfer-python and xgrammar from main; llguidance and
  mistral-common from NVIDIA#22185.

Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that
selection, the xgrammar and llguidance Tekken tokenizers, mistral-common
chat rendering with images and the mistral_native serving extension, the
KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and
passing history tool-call arguments to mistral-common as sent. On top of it,
Mistral Large 4 keeps:

- its model type among the native Mistral model types, with its
  placeholder metadata;
- MistralLarge4ServingExtension as a subclass of the Mistral-native one
  (which now registers for mistral_common only), adding the output-budget
  check, the forced tool-call grammar and the raw structured-output grammar;
- the llguidance JSON grammar that may open with a [THINK] section and the
  tool-call grammar, from mistral-common's grammar factory;
- a Mistral Large 4 prompt's token ids with one [IMG] per image expanded
  to the image grids (other checkpoints keep NVIDIA#22185's check);
- lm-eval's native chat token ids and scoring on the reasoning parser's
  content, and mistral-style tool-call ids.

The feature branch's own copies of these paths, its native_chat processor
branch and its coercion of malformed history tool-call arguments are
dropped.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 23, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0),
applied on main (first 19c1f46, now 3705333 with NVIDIA#22185):

- fece87e [None][feat] Add Mistral Large 4 support
- 9df1a00 [None][fix] Keep requirements installable on Python 3.10
- 5f00308 [None][doc] Mistral Large 4: install from the release container
  or wheel (NVIDIA#21425)
- bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight
  loader and mapper (NVIDIA#21548)
- 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and
  leftovers of removed paths (NVIDIA#21616)

Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL
release, attention-DP dummy paired draft KV, context warmup beside a
capturable guided decoder, per-rank spec-decoding stats), and the six
infra commits already on main (NVIDIA#21133, NVIDIA#19557,
(cf7ae79, 1.4.0a0).

Adapted to main:

- modeling_v2 routing: the family registers its route with
  @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it;
  route takes (model_config, llm_args, compute_capability). The routing
  tests use main's per-family sm_103 fixture; the engine-config tests
  record the route through registered_routes and resolve on one rank.
- thop_attention call sites use main's argument names (workspace,
  spec_decoding_position_offsets); top_k kernels come from
  _torch/kernels/blackwell/top_k.
- Catalog: the targets' cells move into each op test's TARGET_CELLS
  (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps
  main's op.
- DSpark/DFlash: the native drafter's hooks sit on main's refactored
  worker (block placement, vocab-parallel drafting, Markov TP exchange);
  the recurrent Markov head takes its hidden states directly and the
  fused paged-latent path is not taken for drafters with their own block
  embedding.
- KVCacheManagerV2 keeps has_buffer next to main's mixed-precision
  get_buffers.
- Serving: the chat path runs on main's prompt pipeline and
  ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding
  ("native" required-tool mode) and validate_chat_request. `store` follows
  main (accepted and ignored).
- Tests follow main's engine/runner refactor (ModelEngine,
  filter_prefill_capture_num_tokens, removed validate_feature_combination),
  main's scoped reference precision (true_fp32_matmul) and scoped engine
  environments (scoped_env_overrides).
- Dependencies: flashinfer-python and xgrammar from main; llguidance and
  mistral-common from NVIDIA#22185.

Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that
selection, the xgrammar and llguidance Tekken tokenizers, mistral-common
chat rendering with images and the mistral_native serving extension, the
KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and
passing history tool-call arguments to mistral-common as sent. On top of it,
Mistral Large 4 keeps:

- its model type among the native Mistral model types, with its
  placeholder metadata;
- MistralLarge4ServingExtension as a subclass of the Mistral-native one
  (which now registers for mistral_common only), adding the output-budget
  check, the forced tool-call grammar and the raw structured-output grammar;
- the llguidance JSON grammar that may open with a [THINK] section and the
  tool-call grammar, from mistral-common's grammar factory;
- a Mistral Large 4 prompt's token ids with one [IMG] per image expanded
  to the image grids (other checkpoints keep NVIDIA#22185's check);
- lm-eval's native chat token ids and scoring on the reasoning parser's
  content, and mistral-style tool-call ids.

The feature branch's own copies of these paths, its native_chat processor
branch and its coercion of malformed history tool-call arguments are
dropped.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 24, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0),
applied on main (first 19c1f46, now 3705333 with NVIDIA#22185):

- fece87e [None][feat] Add Mistral Large 4 support
- 9df1a00 [None][fix] Keep requirements installable on Python 3.10
- 5f00308 [None][doc] Mistral Large 4: install from the release container
  or wheel (NVIDIA#21425)
- bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight
  loader and mapper (NVIDIA#21548)
- 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and
  leftovers of removed paths (NVIDIA#21616)

Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL
release, attention-DP dummy paired draft KV, context warmup beside a
capturable guided decoder, per-rank spec-decoding stats), and the six
infra commits already on main (NVIDIA#21133, NVIDIA#19557,
(cf7ae79, 1.4.0a0).

Adapted to main:

- modeling_v2 routing: the family registers its route with
  @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it;
  route takes (model_config, llm_args, compute_capability). The routing
  tests use main's per-family sm_103 fixture; the engine-config tests
  record the route through registered_routes and resolve on one rank.
- thop_attention call sites use main's argument names (workspace,
  spec_decoding_position_offsets); top_k kernels come from
  _torch/kernels/blackwell/top_k.
- Catalog: the targets' cells move into each op test's TARGET_CELLS
  (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps
  main's op.
- DSpark/DFlash: the native drafter's hooks sit on main's refactored
  worker (block placement, vocab-parallel drafting, Markov TP exchange);
  the recurrent Markov head takes its hidden states directly and the
  fused paged-latent path is not taken for drafters with their own block
  embedding.
- KVCacheManagerV2 keeps has_buffer next to main's mixed-precision
  get_buffers.
- Serving: the chat path runs on main's prompt pipeline and
  ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding
  ("native" required-tool mode) and validate_chat_request. `store` follows
  main (accepted and ignored).
- Tests follow main's engine/runner refactor (ModelEngine,
  filter_prefill_capture_num_tokens, removed validate_feature_combination),
  main's scoped reference precision (true_fp32_matmul) and scoped engine
  environments (scoped_env_overrides).
- Dependencies: flashinfer-python and xgrammar from main; llguidance and
  mistral-common from NVIDIA#22185.

Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that
selection, the xgrammar and llguidance Tekken tokenizers, mistral-common
chat rendering with images and the mistral_native serving extension, the
KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and
passing history tool-call arguments to mistral-common as sent. On top of it,
Mistral Large 4 keeps:

- its model type among the native Mistral model types, with its
  placeholder metadata;
- MistralLarge4ServingExtension as a subclass of the Mistral-native one
  (which now registers for mistral_common only), adding the output-budget
  check, the forced tool-call grammar and the raw structured-output grammar;
- the llguidance JSON grammar that may open with a [THINK] section and the
  tool-call grammar, from mistral-common's grammar factory;
- a Mistral Large 4 prompt's token ids with one [IMG] per image expanded
  to the image grids (other checkpoints keep NVIDIA#22185's check);
- lm-eval's native chat token ids and scoring on the reasoning parser's
  content, and mistral-style tool-call ids.

The feature branch's own copies of these paths, its native_chat processor
branch and its coercion of malformed history tool-call arguments are
dropped.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 26, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0),
applied on main (first 19c1f46, now 3705333 with NVIDIA#22185):

- fece87e [None][feat] Add Mistral Large 4 support
- 9df1a00 [None][fix] Keep requirements installable on Python 3.10
- 5f00308 [None][doc] Mistral Large 4: install from the release container
  or wheel (NVIDIA#21425)
- bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight
  loader and mapper (NVIDIA#21548)
- 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and
  leftovers of removed paths (NVIDIA#21616)

Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL
release, attention-DP dummy paired draft KV, context warmup beside a
capturable guided decoder, per-rank spec-decoding stats), and the six
infra commits already on main (NVIDIA#21133, NVIDIA#19557,
(cf7ae79, 1.4.0a0).

Adapted to main:

- modeling_v2 routing: the family registers its route with
  @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it;
  route takes (model_config, llm_args, compute_capability). The routing
  tests use main's per-family sm_103 fixture; the engine-config tests
  record the route through registered_routes and resolve on one rank.
- thop_attention call sites use main's argument names (workspace,
  spec_decoding_position_offsets); top_k kernels come from
  _torch/kernels/blackwell/top_k.
- Catalog: the targets' cells move into each op test's TARGET_CELLS
  (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps
  main's op.
- DSpark/DFlash: the native drafter's hooks sit on main's refactored
  worker (block placement, vocab-parallel drafting, Markov TP exchange);
  the recurrent Markov head takes its hidden states directly and the
  fused paged-latent path is not taken for drafters with their own block
  embedding.
- KVCacheManagerV2 keeps has_buffer next to main's mixed-precision
  get_buffers.
- Serving: the chat path runs on main's prompt pipeline and
  ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding
  ("native" required-tool mode) and validate_chat_request. `store` follows
  main (accepted and ignored).
- Tests follow main's engine/runner refactor (ModelEngine,
  filter_prefill_capture_num_tokens, removed validate_feature_combination),
  main's scoped reference precision (true_fp32_matmul) and scoped engine
  environments (scoped_env_overrides).
- Dependencies: flashinfer-python and xgrammar from main; llguidance and
  mistral-common from NVIDIA#22185.

Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that
selection, the xgrammar and llguidance Tekken tokenizers, mistral-common
chat rendering with images and the mistral_native serving extension, the
KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and
passing history tool-call arguments to mistral-common as sent. On top of it,
Mistral Large 4 keeps:

- its model type among the native Mistral model types, with its
  placeholder metadata;
- MistralLarge4ServingExtension as a subclass of the Mistral-native one
  (which now registers for mistral_common only), adding the output-budget
  check, the forced tool-call grammar and the raw structured-output grammar;
- the llguidance JSON grammar that may open with a [THINK] section and the
  tool-call grammar, from mistral-common's grammar factory;
- a Mistral Large 4 prompt's token ids with one [IMG] per image expanded
  to the image grids (other checkpoints keep NVIDIA#22185's check);
- lm-eval's native chat token ids and scoring on the reasoning parser's
  content, and mistral-style tool-call ids.

The feature branch's own copies of these paths, its native_chat processor
branch and its coercion of malformed history tool-call arguments are
dropped.

Signed-off-by: Yi Zhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant