← All models

image-text-to-text Β· vision-language Β· WebGPU Β· ~2.9 GB

Qwen2.5-VL β€” read at native resolution, and point at what it sees

Qwen2.5-VL is the next-generation successor to Qwen2-VL. Instead of squashing every image into a fixed square, it processes pictures at their native resolution and aspect ratio β€” so fine print, dense tables and small chart labels survive. It's a stronger document parser and, uniquely, it can ground its answers: ask it to locate something and it emits the bounding-box coordinates. Give it an image and a prompt; the answer streams token by token on your GPU, nothing uploaded.

At a glance

Modelonnx-community/Qwen2.5-VL-3B-Instruct-ONNX (ONNX build of Qwen/Qwen2.5-VL-3B-Instruct)
Taskimage-text-to-text (vision β†’ text generation)
ArchitectureRedesigned ViT vision encoder (window attention, dynamic resolution, absolute-time mRoPE) + Qwen2.5 text decoder
Params / dtype~3B Β· decoder q4f16, vision + embeddings fp16
BackendWebGPU (required β€” needs a GPU + shader-f16)
Download~2.9 GB, cached after first load
LicenseApache-2.0
RuntimeTransformers.js 4.2.0 (the Qwen2_5_VLForConditionalGeneration class is version-pinned in this demo's worker only)
Web APIsWebGPU, Web Workers, FileReader

Distinct from the built Qwen2-VL demo: 2.5 keeps the native aspect ratio (Qwen2-VL clamps to a square), reads documents/charts more reliably, and can return grounding boxes. Compare them side by side.

Run it

A vertical bar chart of survey responses A screenshot of a dense text-heavy Wikipedia article Citrus fruits arranged on a surface A dog standing on grass A narrow European street scene
…or drop / choose your own image
Selected image

Bar chart β€” User:Dcrjsr, via Wikimedia Commons, CC BY-SA 3.0

The model's answer will stream here.

See inside

A VLM doesn't "see" β€” it reads a sequence of tokens where your image has been turned into a block of vision tokens and slotted into a chat template alongside your words. Because Qwen2.5-VL uses dynamic resolution, that block isn't a fixed size: a bigger or wider image becomes more vision tokens (more detail, more compute). Below is the exact templated prompt, the live image-token count for the picture you chose, and the token stream with the time each token arrived β€” so you can watch it read and see where the latency goes.

Constructed chat template

Run a generation to see the templated prompt.

Token stream (value Β· ms since start)

Tokens appear here as they're generated.

Why it matters

Qwen2.5-VL pushes the "reading and pointing" VLM further: native-resolution input means it holds up on real documents β€” small fonts, dense tables, chart tick labels β€” where a fixed-square model loses detail. And grounding turns "describe" into "locate": the model can hand back coordinates, not just prose. Running that in a browser tab β€” privately, offline-capable, free per call β€” turns a lot of server-side document and vision plumbing into a client-side primitive.

Use cases

Basics

Describe or ask about an image β€” the core "talk to a picture" loop, at native resolution.

Practical

Read a chart, document, or screenshot and extract the answer β€” OCR + reasoning on real pages.

Wild

Visual grounding β€” ask it to locate objects and watch the bounding boxes get drawn on the image.

Multi-model

Qwen2.5-VL reads a document β†’ a summariser turns the extract into a one-line digest.

How the API works

Qwen2.5-VL in Transformers.js uses a dedicated model class (new in v4.2). You build a chat message whose content mixes an image placeholder and text, template it, run the processor over the templated text plus the image, then generate β€” streaming tokens as they come. Because the processor keeps the native aspect ratio, we resize to a multiple of 28 first so the vision-token grid is predictable:

import { AutoProcessor, Qwen2_5_VLForConditionalGeneration, RawImage, TextStreamer }
  from "@huggingface/transformers"; // v4.2.0 β€” Qwen2_5_VL class is not in 3.7.5

const model_id = "onnx-community/Qwen2.5-VL-3B-Instruct-ONNX";
const processor = await AutoProcessor.from_pretrained(model_id);
const model = await Qwen2_5_VLForConditionalGeneration.from_pretrained(model_id, {
  dtype: { embed_tokens: "fp16", vision_encoder: "fp16", decoder_model_merged: "q4f16" },
  device: "webgpu",                        // WebGPU required
});

const image = await RawImage.read(imageURL); // kept at native aspect ratio (dynamic resolution)
const conversation = [
  { role: "user", content: [{ type: "image" }, { type: "text", text: prompt }] },
];
const text = processor.apply_chat_template(conversation, { add_generation_prompt: true });
const inputs = await processor(text, image);   // inputs.image_grid_thw = the vision-token grid

const streamer = new TextStreamer(processor.tokenizer,
  { skip_prompt: true, skip_special_tokens: true, callback_function: (t) => append(t) });
await model.generate({ ...inputs, max_new_tokens: 256, do_sample: false, streamer });

This page runs exactly that, in a Web Worker, and gates on a real WebGPU adapter first β€” if none exists it shows a labelled needs-WebGPU state instead of a fake answer.

References