Expand description
2026-09-25: The Qwen3-VL-shaped vision encoder: a ViT with optional DeepStack mergers.
Owner: model-layers (vision). Invariants:
- At most one scratch group is stored (
scratchis aOnceLock); it is set on the first image or byVisionTower::ensure_scratch.
Pixels go through patch embedding, the ViT blocks and a final spatial
merger. The first Σmerged_p rows of buf_out hold the final merger’s
output, [Σmerged_p, out_hidden_size] BF16, which the LLM embeds. Each
DeepStack merger listed in deepstack_indexes writes its own region after
that in the batched path; the LLM does not read those regions.
Structs§
- Merger
Layer - ViTBlock
- Vision
Encoder - Vision
Scratch - 2026-09-25: The ViT’s per-image scratch buffers, allocated as one group.
Constants§
- IMAGE_
PAD_ TOKEN_ ID - VIDEO_
PAD_ TOKEN_ ID - 2026-09-25: Fallback
<|video_pad|>id, used when the checkpoint’s config declares none (or 0). The Qwen3-VL, Qwen3.6 and Qwen3.8 checkpoints all put the video token directly after the image token. A declared id always wins, as for the image token.