image-text-to-text Β· vision-language Β· WebGPU Β· ~2.9 GB
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.
| Model | onnx-community/Qwen2.5-VL-3B-Instruct-ONNX (ONNX build of Qwen/Qwen2.5-VL-3B-Instruct) |
|---|---|
| Task | image-text-to-text (vision β text generation) |
| Architecture | Redesigned ViT vision encoder (window attention, dynamic resolution, absolute-time mRoPE) + Qwen2.5 text decoder |
| Params / dtype | ~3B Β· decoder q4f16, vision + embeddings fp16 |
| Backend | WebGPU (required β needs a GPU + shader-f16) |
| Download | ~2.9 GB, cached after first load |
| License | Apache-2.0 |
| Runtime | Transformers.js 4.2.0 (the Qwen2_5_VLForConditionalGeneration class is version-pinned in this demo's worker only) |
| Web APIs | WebGPU, 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.

Bar chart β User:Dcrjsr, via Wikimedia Commons, CC BY-SA 3.0
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.
Run a generation to see the templated prompt.
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.
Describe or ask about an image β the core "talk to a picture" loop, at native resolution.
Read a chart, document, or screenshot and extract the answer β OCR + reasoning on real pages.
Visual grounding β ask it to locate objects and watch the bounding boxes get drawn on the image.
Qwen2.5-VL reads a document β a summariser turns the extract into a one-line digest.
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.