LLM Learning Hub

workspace/llm-course/home

Vision Encoder

The vision encoder is the image backbone (usually a ViT) that extracts patch-level features from an image, which are then projected and fed into the language model as visual tokens.

What is Vision Encoder?

The vision encoder is the image backbone (usually a ViT) that extracts patch-level features from an image, which are then projected and fed into the language model as visual tokens.

The vision encoder is the image backbone (usually a ViT) that extracts patch-level features from an image, which are then projected and fed into the language model as visual tokens.

Where is it used?

LLaVA uses CLIP-ViT-L/14, Qwen2-VL uses a custom ViT with dynamic resolution, and InternVL uses InternViT; SigLIP is the encoder for Pixtral and Idefics3.

How to build it

Load `ViTModel.from_pretrained("google/vit-base-patch16-224")`, pass `pixel_values`, and take `outputs.last_hidden_state` (shape `(1, n_patches, hidden)`) as visual token features.