transformer_lens.model_bridge.supported_architectures.qwen3_vl module

Qwen3-VL architecture adapter.

Alibaba’s Qwen3-VL (Qwen3VLForConditionalGeneration): a ViT tower at model.visual matching the Qwen3.5 vision layout (learned pos_embed + 2D rotary, qkv/proj attention, fc1/fc2 MLP) plus DeepStack — extra patch mergers on early vision blocks whose features the text model injects into the residual stream at visual token positions during the first decoder layers. The injection itself is a tensor add inside the HF text loop (not a module call); the per-level DeepStack mergers are wrapped so their features are hookable at the source. Because the injection happens BETWEEN block calls, blocks.{i}.hook_out omits it while blocks.{i+1}’s input contains it on image runs — resid_post[i] != resid_pre[i+1] at visual positions for the first DeepStack layers, and patching resid_post there drops the injection (prefer blocks.{i+1}.hook_in). Text attention is Qwen3-style (per-head QK RMS-norm) with interleaved mRoPE, HF-native.

class transformer_lens.model_bridge.supported_architectures.qwen3_vl.Qwen3VLArchitectureAdapter(cfg: Any)

Bases: ArchitectureAdapter

Architecture adapter for Qwen3VLForConditionalGeneration models.

__init__(cfg: Any) None

Initialize the Qwen3-VL architecture adapter.

component_mapping: ComponentMapping | None
required_libraries: list[str] = ['torchvision']
required_libraries_group: str = 'multimodal'
uses_split_attention: bool
weight_processing_conversions: Dict[str, ParamProcessingConversion | str] | None