skills/model-optimization/sglang/sglang-glm-vlm-ocr-optimization/SKILL.md
PR-backed and current-main optimization manual for GLM-4V, GLM-4.1V, GLM-4.5V, GLM-4.6V, GLM-Glyph, and GLM-OCR in SGLang. Use when an engineer needs to recover, extend, or audit GLM vision processors, GLM4V MoE, vision encoder DP/PP, GLM-OCR/NextN loading, transformers compatibility, Conv3D-to-linear projection, AMD/NPU validation, or VLM/OCR cookbook recipes.
npx skillsauth add BBuf/AI-Infra-Auto-Driven-SKILLS sglang-glm-vlm-ocr-optimizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill covers GLM visual and OCR models: GLM-4V, GLM-4.1V, GLM-4.5V, GLM-4.6V, GLM-Glyph, and GLM-OCR. It is separate from GLM text because the processor, vision encoder, image token placement, transformers compatibility, and OCR-specific NextN behavior dominate debugging.
Current evidence snapshot:
origin/main: b3e6cf60a on 2026-04-22origin/main: 816bad5 on 2026-04-21references/pr-history.mdglm4v.py, glm4v_moe.py, glm_ocr.py, glm_ocr_nextn.pymultimodal/processors/glm4v.py, glmasr.py when audio-adjacentUse skills/model-optimization/model-pr-diff-dossier/SKILL.md as the production bar.
Every PR cited for this family must be based on diff reading, not only PR titles.
Capture:
Start at the multimodal boundary.
#20463 and #20740 as a pair: #20463 documents a real Conv3D-to-linear loader regression mechanism, while #20740 defines the current-main state after revert.python/sglang/srt/models/glm4v.pypython/sglang/srt/models/glm4v_moe.pypython/sglang/srt/models/glm_ocr.pypython/sglang/srt/models/glm_ocr_nextn.pypython/sglang/srt/multimodal/processors/glm4v.pydocs_new/cookbook/autoregressive/GLM/GLM-4.5V.mdxdocs_new/cookbook/autoregressive/GLM/GLM-4.6V.mdxdocs_new/cookbook/autoregressive/GLM/GLM-Glyph.mdxdocs_new/cookbook/autoregressive/GLM/GLM-OCR.mdxWhen producing or updating model optimization history, do not summarize a PR as one sentence. Read the source diff and write:
development
Perform SGLang code review in the style of human maintainers by consulting the full non-agent PR review episode corpus from project start through the latest refresh (June 2026), including inline review threads, top-level PR comments, review submissions, original multilingual text, and multi-round discussions. Use when reviewing SGLang PRs, diffs, patches, or local changes for correctness, tests, performance, GPU/runtime risks, API compatibility, and maintainability.
documentation
Use when an SGLang, vLLM, or TensorRT-LLM serving/model optimization task needs prior model-family PR evidence. Query and read the PR-driven history docs under model-pr-optimization-history before choosing source paths, fast paths, kernel/fusion ideas, regression risks, or validation lanes.
development
Run an autonomous Humanize-governed vLLM SOTA performance loop for one LLM model: first perform the fixed fair vLLM/SGLang/TensorRT-LLM deployment search and benchmark, then start one RLCR loop that repeatedly decides the gap, profiles the current bottleneck, runs layer/kernel pipeline analysis, patches vLLM code, optionally uses ncu-report-skill for kernel evidence, and revalidates until vLLM matches or beats the best observed framework under the same workload and SLA.
devops
Inspect LLM torch profiler traces at forward-pass, layer, and kernel level. Use when you need layer timings, anchor-kernel boundaries, representative kernel flows, or Perfetto time ranges.