DecodeCudaGraphConfig#

class tensorrt_llm.llmapi.DecodeCudaGraphConfig(
*,
batch_sizes: List[int] | None = None,
max_batch_size: Annotated[int, Ge(ge=0)] = 0,
enable_padding: bool = False,
mode: Literal['decode'] = 'decode',
sampling_variants: Annotated[List[Literal['greedy', 'advanced', 'temperature_only']] | None, MinLen(min_length=1)] = None,
)[source]#

Bases: BaseCudaGraphConfig

CUDA graph configuration for decode requests.

field batch_sizes: List[int] | None = None#

List of batch sizes to create CUDA graphs for.

field enable_padding: bool = False#

If true, batches are rounded up to the nearest cuda_graph_batch_size. This is usually a net win for performance.

field max_batch_size: NonNegativeInt = 0#

Maximum batch size for CUDA graphs.

Constraints:
  • ge = 0

field mode: Literal['decode'] = 'decode'#

CUDA graph configuration mode.

field sampling_variants: List[Literal['greedy', 'advanced', 'temperature_only']] | None = None#

Sampling variants captured as CUDA graphs with one-engine speculative decoding. ‘greedy’ serves decode batches whose requests all decode greedily; ‘advanced’ serves batches with a sampled request, one whose temperature, top-k, top-p or min-p does not resolve to greedy decoding (a seed or a penalty alone does not); ‘temperature_only’ serves sampled batches whose sampled requests are unseeded and set only a temperature of at least 1e-4, where the target tokens are sampled from vocabulary-sharded logits: MTP-Eagle one-model decode with spec-decode fast paths, or with TLLM_SPEC_VOCAB_PARALLEL_TEMPERATURE=1 and an eligible vocabulary-sharded LM head. Both MTP-Eagle paths require tensor parallelism without attention DP, relaxed acceptance, guided decoding or watermark_config. Embedded DSpark drafts in the target checkpoint (the DeepSeek-V4 family) support this with tensor parallelism, or with attention DP and enable_lm_head_tp_in_adp. Both need no rejection sampling or penalties; elsewhere the first capture rejects it. By default every variant the engine supports is captured. Without ‘temperature_only’, temperature-only batches use ‘advanced’. Without ‘greedy’, greedy batches use the sampled graphs (‘temperature_only’ if listed, else ‘advanced’) and still decode greedily, but add sampling-parameter and RNG-state uploads, take the sampled path in eager steps too, can break exact ties differently on ‘advanced’, and lose the argmax fast paths: with rejection sampling, argmax drafting and its LM-head-TP path, and the vocabulary-sharded target argmax where the model has one (models with the spec-decode fast paths and embedded DSpark drafts keep it by listing ‘temperature_only’, unless they use rejection sampling; DFlash with tensor parallelism keeps its shard selection without rejection sampling and with advanced_sampling_mode ‘no_topk_no_topp’). Without ‘advanced’, a sampled batch that ‘temperature_only’ does not serve runs eagerly; under attention DP the whole step then runs eagerly on every rank.

Constraints:
  • min_length = 1

__init__(**data: Any) → None#

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

validator validate_base_cuda_graph_config  »  all fields#

Validate CUDA graph configuration.

Ensures that: 1. If batch_sizes is provided, max_batch_size is derived as max(batch_sizes).

If max_batch_size was already set it must be compatible (equal to max(batch_sizes)); otherwise an error is raised.

  1. If only max_batch_size is provided, batch_sizes is generated from it.

  2. If neither is provided, a default max_batch_size of 128 is used.

validator validate_sampling_variants  »  sampling_variants[source]#

Reject a repeated variant.