Skip to content

feat(mm-routing): integrate GLM-5.3-Flash image planner - #3

Closed
HanFa wants to merge 1 commit into
codex/dis-3123-image-token-accounting-errorsfrom
codex/dis-3123-glm-image-routing
Closed

HanFa wants to merge 1 commit into
codex/dis-3123-image-token-accounting-errorsfrom
codex/dis-3123-glm-image-routing

Conversation

@HanFa

@HanFa HanFa commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Superseded by ai-dynamo#17121, targeting upstream main after ai-dynamo#16947 merged. The upstream PR contains the same GLM integration commit replayed onto the updated base.

Summary

Connect GLM-5.3-Flash image routing to the default Rust frontend through the shared glm5_next planner. Use checkpoint metadata for image token counts and validate the rendered prompt layout before constructing exact routing tokens. Unsupported configuration, accounting failures, and layout failures retain text-prefix routing.

Details

  • Pin the optional dynamo-multimodal dependency to 0.2.2 with default features disabled; update both Cargo lockfiles.
  • Select the GLM adapter before the legacy flat-config loader so nested processor_config.json checkpoints are supported.
  • Delegate image counts and layout validation to the shared planner. Expand image placeholders using the existing repeated-pad path, retaining delimiters and the worker-bound prompt.
  • Add Rust coverage for checkpoint-driven geometry, single/multiple images, layout parity, content-sensitive routing tokens, and fallback without partial routing/hash installation.
  • Add real Python binding resolver tests using shared lightweight checkpoint fixtures, including nested/flat configs and unsupported or malformed metadata.

Stack

Depends on ai-dynamo#16947.

This PR is intentionally opened in HanFa/dynamo with base codex/dis-3123-image-token-accounting-errors, so its diff contains only the GLM integration commit. The prerequisite targets ai-dynamo/dynamo:main.

After the prerequisite merges upstream, port this GLM commit onto the updated upstream main and open its upstream PR. This fork PR is the incremental review for the second step.

Where should the reviewer start?

Start with lib/llm/src/preprocessor/mm_routing/glm5_next.rs, then the adapter selection and layout-validation call sites. lib/llm/src/preprocessor/glm5_next_tests.rs exercises the preprocessing boundary; lib/bindings/python/tests/test_routing_image_token_id.py exercises the existing Rust resolver exposed to Python.

Validation

  • cargo test -p dynamo-llm --no-default-features --features mm-routing --locked --lib preprocessor:: -- --test-threads=4: 383 passed, 2 ignored with the prerequisite applied.
  • python -m pytest lib/bindings/python/tests/test_routing_image_token_id.py -q: 11 passed against locally built bindings with mm-routing enabled.
  • cargo fmt --all --check, Ruff, git diff --check, and repository commit hooks: passed.
  • Local validation used macOS and no model weights. Three-backend GPU E2E, cache-event parity, and the supported runtime/checkpoint matrix remain follow-up work; this PR does not claim full backend acceptance.

Related Issues

Part of ai-dynamo#16948.

Internal tracking: DIS-3123 (multimodal-aware KV routing model support).

Consumes the shared planner from ai-dynamo/frontend-crates#412, released in dynamo-multimodal 0.2.2.

Use dynamo-multimodal 0.2.2 for checkpoint-driven GLM image token counts and layout validation. Select the adapter before legacy flat-config loading and fall back to text-prefix routing when planning is unsupported or fails.

Add Rust adapter and preprocessing tests plus real Python binding resolver tests with shared lightweight checkpoint fixtures. Three-backend routing E2E remains follow-up work.

Validation: targeted preprocessor Rust tests passed (383 passed, 2 ignored); Python binding tests passed (11 passed); cargo fmt, Ruff, and git diff --check passed.
Signed-off-by: Fang Han <fangh@nvidia.com>

This branch had an error being deployed

1 failed deployment
external_collaborator — 3a123c6a Deployed Oct 20, 2026 by HanFa via ok-to-test #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant