Skip to content

[TRTLLM-385][doc] Add Configuration Schema for LlmArgs, AutoDeploy, and VisualGeneration Classes - #14159

Open
arysef wants to merge 7 commits into
NVIDIA:mainfrom
arysef:trtllm-serve-yaml-schemas
Open

arysef wants to merge 7 commits into
NVIDIA:mainfrom
arysef:trtllm-serve-yaml-schemas

Conversation

@arysef

@arysef arysef commented May 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added JSON schema files for trtllm-serve configurations, enabling IDE and YAML editor schema validation with autocomplete and real-time validation across all configuration types
  • Documentation

    • Updated trtllm-serve documentation with schema references and code examples to help users set up IDE support
  • Tests

    • Added comprehensive test suite validating configuration schemas and integration with documentation generation

Review Change Stack

Description

Generates config schema to make basic static configuration checks easier for users. Adds pages to the trtllm docs to allow users to source the schema from the latest releases.

Test Coverage

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.

arysef added 2 commits May 13, 2026 15:36
Signed-off-by: asefidi <asefidi@nvidia.com>
- Generate trtllm-serve-autodeploy-config.schema.json from
  tensorrt_llm._torch.auto_deploy.llm_args.LlmArgs so users running with
  --backend _autodeploy get an IDE-validatable schema for that backend's
  YAML surface.
- Strip json_schema_extra "type" strings ("Union[...]", "Literal[...]")
  that previously left the serve config schema invalid under JSON Schema
  Draft 2020-12 and broke Draft202012Validator.check_schema.
- Widen env_overrides values to match the runtime str-coercion validator
  so unquoted scalar YAML (e.g. TRTLLM_ENABLE_PDL: 1) validates in
  existing configs.
- Read tensorrt_llm/version.py directly (no package import) to embed the
  trtllm version in SCHEMA_BASE_URL, pinning each release's schemas
  immutably; docs example URLs stay on /latest/ with a pin-note.
- Add tests for the autodeploy schema (minimal, aliases, wrong-backend,
  typo) and for unquoted env_overrides scalars.
- Tighten the "Configuring with YAML Files" section to a single
  schema-directive block with the AutoDeploy schema linked inline.

Signed-off-by: asefidi <asefidi@nvidia.com>
Pre-commit's ruff-format hook reformatted the two python files (mostly
line-length and dict/string-literal wrapping). No behavior change; the
schema test suite still passes (219 tests).

Signed-off-by: asefidi <asefidi@nvidia.com>
@arysef arysef changed the title [doc] Add Configuration Schema for LlmArgs, AutoDeploy, and VisualGeneration Classes [#385][doc] Add Configuration Schema for LlmArgs, AutoDeploy, and VisualGeneration Classes May 14, 2026
@arysef arysef changed the title [#385][doc] Add Configuration Schema for LlmArgs, AutoDeploy, and VisualGeneration Classes [TRTLLM-385][doc] Add Configuration Schema for LlmArgs, AutoDeploy, and VisualGeneration Classes May 14, 2026
_widen(branch)


def _add_schema_metadata(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This does not affect runtime, but there is one schema coverage gap around disaggregated serving. trtllm-serve <model> --config supports a serve-level disagg_cluster key: serve.py pops it from the merged config and converts it to DisaggClusterConfig. The disaggregated README also documents putting disagg_cluster in context/generation server configs.

Since this schema is advertised for trtllm-serve --config and uses additionalProperties=false, a valid worker config containing disagg_cluster: would be flagged as invalid by IDEs. Could we either add this serve-level key to the schema, or document that the schema only covers the LLM args portion and not serve-level disaggregated options?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added a schema for the disagg orchestrator and expanded the schema for disagg_cluster/worker

arysef added 2 commits May 18, 2026 21:33
…ve schemas

- Generate trtllm-serve-disagg-config.schema.json from
  tensorrt_llm.llmapi.disagg_utils dataclasses (via TypeAdapter) plus
  the TorchLlmArgs surface. The orchestrator YAML accepted by
  trtllm-serve disaggregated --config is validated end-to-end:
  TorchLlmArgs fields at the top level (inherited into each server
  block), disagg-specific fields (hostname, port, schedule_style,
  max_retries, perf_metrics_max_requests, node_id,
  conditional_disagg_config, otlp_config, disagg_cluster) at the top
  level, and nested context_servers / generation_servers
  (DisaggServerBlock) with the same TorchLlmArgs surface plus
  num_instances, urls, and router.
- backend is widened to enum: [pytorch, _autodeploy, tensorrt, trt] to
  match what the legacy TRT-backend disagg test configs use;
  free_gpu_memory_fraction is exposed as a CLI alias the runtime
  propagates into each worker's KvCacheConfig.
- Add disagg_cluster to the serve and autodeploy schemas as well:
  trtllm-serve serve pops disagg_cluster from the parsed YAML before
  LLM construction (serve.py), so workers can join a disagg cluster
  via the regular config. Use the same DisaggClusterConfig shape so
  the worker-side and orchestrator-side cluster blocks stay in lockstep.
- Add unit tests (minimal yaml, inherited torch args, gen-only via
  num_instances=0, top-level typo, nested typo, bad schedule_style,
  disagg_cluster on serve + autodeploy, missing cluster_uri) and
  parametrize over the existing examples/disaggregated/*.yaml configs.
- Rephrase the docs schema-directive paragraph so each schema is tied
  to its subcommand surface: trtllm-serve serve --config, --backend
  _autodeploy, and trtllm-serve disaggregated --config each get their
  own schema link.

Signed-off-by: asefidi <asefidi@nvidia.com>
CI's pre-commit hook flagged two short lines that fit on one line each
(spec_from_file_location call and RuntimeError message). Apply the
reformat so the hook passes.

Signed-off-by: asefidi <asefidi@nvidia.com>
@arysef
arysef marked this pull request as ready for review May 18, 2026 23:16
@arysef
arysef requested a review from a team as a code owner May 18, 2026 23:16
@arysef
arysef requested review from chang-l and venkywonka May 18, 2026 23:16
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR establishes JSON Schema generation for TensorRT-LLM's trtllm-serve YAML configurations using Pydantic, integrates schema files into documentation builds via a Sphinx extension, and provides IDE schema directives for developer autocompletion and validation.

Changes

Schema Generation and IDE Support

Layer / File(s) Summary
Core schema generation helpers and metadata
scripts/generate_trtllm_serve_schemas.py (lines 1–158)
Establishes schema generation foundation: reads TensorRT-LLM version, customizes Pydantic's JSON schema generation to relax runtime-only types, post-processes schemas to strip invalid type entries, widens env_overrides typing, and centralizes metadata injection.
Disaggregated configuration schema construction
scripts/generate_trtllm_serve_schemas.py (lines 293–451)
Builds specialized disaggregated config schema by extending TorchLlmArgs with server-block structure (num_instances, urls, router), backend enum, networking/scheduling/retry/metrics fields, and nested subschemas.
Schema writing and command-line interface
scripts/generate_trtllm_serve_schemas.py (lines 452–508)
Implements schema output for serve, autodeploy, disagg, and visual-gen with deterministic JSON serialization and CLI entry point.
Test infrastructure and validation fixtures
tests/unittest/llmapi/test_trtllm_serve_config_schemas.py (lines 1–90)
Discovers example YAML config files, dynamically loads schema generator, and creates Draft 2020-12 validator fixtures for all four schema types.
Schema validation tests for all configuration types
tests/unittest/llmapi/test_trtllm_serve_config_schemas.py (lines 91–284)
Validates serve, autodeploy, disagg, and visual-gen schemas; tests minimal fields, alias acceptance, typo rejection, and parametrized validation of all example YAML files.
Sphinx extension for documentation build integration
docs/source/_ext/trtllm_schema_assets.py, tests/unittest/llmapi/test_trtllm_serve_config_schemas.py (lines 285–301)
Adds Sphinx extension that generates schemas into the documentation build's _static/schemas directory; includes integration test verifying schema file creation.
Documentation updates and extension configuration
docs/source/commands/trtllm-serve/trtllm-serve.rst, docs/source/conf.py
Updates user-facing documentation with IDE schema directives (yaml-language-server directives) for visual-gen and serve configurations, and enables the trtllm_schema_assets Sphinx extension.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description explains the core motivation (generating config schemas for static checks and documentation), but the Test Coverage section is empty and several PR checklist items lack evidence of completion. Complete the Test Coverage section with specific test names/paths (e.g., test_trtllm_serve_config_schemas.py tests), and provide evidence for critical checklist items like dependency scanning and CODEOWNERS updates.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main objective: adding configuration schemas for LlmArgs, AutoDeploy, and VisualGeneration classes, with the JIRA ticket and doc type prefix appropriately formatted.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
tests/unittest/llmapi/test_trtllm_serve_config_schemas.py (1)

287-287: 💤 Low value

Unnecessary parentheses around string literal.

The parentheses around "trtllm_schema_assets.py" serve no purpose and can be removed.

♻️ Proposed fix
-    extension_path = REPO_ROOT / "docs" / "source" / "_ext" / ("trtllm_schema_assets.py")
+    extension_path = REPO_ROOT / "docs" / "source" / "_ext" / "trtllm_schema_assets.py"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/llmapi/test_trtllm_serve_config_schemas.py` at line 287, The
expression assigning extension_path contains unnecessary parentheses around the
string literal; update the assignment for the variable extension_path (in
tests/unittest/llmapi/test_trtllm_serve_config_schemas.py) to remove the
redundant parentheses so the path concatenation uses "trtllm_schema_assets.py"
directly instead of ("trtllm_schema_assets.py").
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/generate_trtllm_serve_schemas.py`:
- Around line 316-358: The DisaggServerBlock schema is built from
server_block_properties before _add_schema_metadata widens env_overrides, so
context_servers/generation_servers still restrict env_overrides to strings;
update the construction so server_block_properties includes the same relaxed
env_overrides schema (e.g., allow string, number, boolean or any scalar) before
assigning defs["DisaggServerBlock"] — modify the block that prepares
server_block_properties (the dict used to build DisaggServerBlock) to include
the widened env_overrides definition (the same shape produced by
_add_schema_metadata) or call _add_schema_metadata on the cloned properties
prior to creating defs["DisaggServerBlock"] so env_overrides accepts non-string
scalar values.
- Around line 407-413: The schema for properties["node_id"] documents a valid
range [0, 1023] but does not enforce it; update the node_id schema to include
numeric bounds by adding "minimum": 0 and "maximum": 1023 (while preserving the
existing "type": ["integer","null"], "default": None, and description) so that
static validation fails for out-of-range integers; locate this in the
properties["node_id"] block and add the two keys.

---

Nitpick comments:
In `@tests/unittest/llmapi/test_trtllm_serve_config_schemas.py`:
- Line 287: The expression assigning extension_path contains unnecessary
parentheses around the string literal; update the assignment for the variable
extension_path (in tests/unittest/llmapi/test_trtllm_serve_config_schemas.py) to
remove the redundant parentheses so the path concatenation uses
"trtllm_schema_assets.py" directly instead of ("trtllm_schema_assets.py").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 01baa3bb-b4a6-4d47-83af-8ecfd904ef8d

📥 Commits

Reviewing files that changed from the base of the PR and between d75df19 and fe0631f.

📒 Files selected for processing (5)
  • docs/source/_ext/trtllm_schema_assets.py
  • docs/source/commands/trtllm-serve/trtllm-serve.rst
  • docs/source/conf.py
  • scripts/generate_trtllm_serve_schemas.py
  • tests/unittest/llmapi/test_trtllm_serve_config_schemas.py

@arysef
arysef requested a review from QiJune May 19, 2026 18:57
arysef added 2 commits June 10, 2026 12:30
…e_id

Signed-off-by: asefidi <asefidi@nvidia.com>

@QiJune QiJune left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@arysef

arysef commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58313 [ run ] triggered by Bot. Commit: d112e04 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58313 [ run ] completed with state SUCCESS. Commit: d112e04
/LLM/main/L0_MergeRequest_PR pipeline #46942 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

@arysef this pull request has had no activity for more than 120 days and currently has merge conflicts. Is it still active? Please resolve the conflicts or post an update. Otherwise, it will be closed after another 60 days of inactivity.

This branch has not been deployed

No deployments
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.

3 participants