Skip to main content
Back

UVLM Lets Researchers Swap LLaVA and Qwen2.5-VL Without Rewriting Code

A new Colab-based framework unifies LLaVA-NeXT and Qwen2.5-VL behind a single inference function, with prompt builder, consensus voting, and chain-of-thought benchmarking baked in.

Pro

  • UVLM unifies LLaVA-NeXT and Qwen2.5-VL inference behind a single Colab-based function with open-source code.
  • Supports four response types (numeric, category, boolean, text) and up to ten tasks per run.
  • Consensus validation runs each task multiple times and majority-votes for reliability.
  • Built-in chain-of-thought mode with token budget up to 1,500 for custom reasoning.
  • Qwen2.5-VL-32B with reasoning topped the 120-image benchmark at 88.0% proximity.
  • Model size did not predict quality: LLaVA 7B beat LLaVA 34B by 20 points.

Anyone who has tried to systematically compare vision-language models across families has run into the same wall: every model ships with its own processor class, chat template, image preprocessing quirks, and decoding conventions. Swapping LLaVA for Qwen is not a one-line change. A new tool called UVLM (Universal Vision-Language Model Loader) tries to fix that by hiding the plumbing behind a single inference function and running the whole thing inside a Google Colab notebook.

UVLM currently supports two major model families, LLaVA-NeXT and Qwen2.5-VL, which differ fundamentally in their vision encoding, tokenization, and decoding strategies. The framework was released alongside a paper that also benchmarks eight checkpoints on 120 annotated street-view images, producing some counterintuitive results about which models actually work best on structured visual reasoning.

Why gluing VLMs together is harder than it looks

The two supported families illustrate why a unified loader is useful. LLaVA uses a CLIP-based vision encoder connected to a language model through a trained MLP projection layer, with a dedicated LlavaNextProcessor that handles image-text interleaving, and the raw output is decoded from the full generated sequence, requiring post-processing to strip prompt tokens and instruction markers. Qwen2.5-VL takes a different route: a redesigned Vision Transformer with RMSNorm, SwiGLU activations, and window-based attention, supporting native-resolution image inputs, using a generic AutoProcessor with separate vision processing utilities and requiring explicit trimming of input token IDs from the generated output before decoding.

These are not superficial API differences. Memory management, generation config handling, and even where prompt-stripping happens (string level vs token level) all diverge. Writing separate pipelines per model is error-prone, so most applied studies just pick one VLM and skip the comparison entirely.

UVLM three-block architecture diagram

How the notebook is wired

UVLM is organized as three sequential Colab blocks so you only pay the model-loading cost once per session:

  • Block 1 - Model loading: A dropdown selects from seven LLaVA-NeXT variants (Mistral 7B, Vicuna 7B/13B, 34B, LLaMA3 8B, 72B, 110B) and four Qwen2.5-VL variants (3B, 7B, 32B, 72B). Precision can be set to FP16, 8-bit, or 4-bit via BitsAndBytes.
  • Block 2 - Prompt builder: A widget form lets you configure up to ten tasks, each with a column name, prompt, and one of four response types (numeric, category, boolean, text).
  • Block 3 - Batch execution: Iterates over a Google Drive folder, writes one CSV row per image, supports resume mode, and flags responses that hit the token ceiling in dedicated {column}_truncated columns.

Two features are worth flagging for anyone using VLMs in production-adjacent settings. First, a consensus validation mechanism inspired by self-consistency runs each task multiple times on the same image and determines the final answer by majority voting, with an optional tolerance parameter for numeric tasks so predictions within a percentage of each other count as equivalent. Second, the max token slider goes up to 1,500, and a built-in advanced reasoning mode automatically swaps the format instruction for a chain-of-thought template that asks the model to describe observations, reason step by step, then emit a final ANSWER: <value> line.

Dual-backend inference pipeline comparison between LLaVA-NeXT and Qwen2.5-VL

The benchmark: 120 French streets, five tasks, one surprise

To validate the tool, the authors ran eight checkpoints in both standard and reasoning modes against 120 street-level photographs annotated by an expert. Tasks ranged from easy (count motor vehicles) to hard (estimate street frontage length in meters using reference objects, or classify vegetation into a six-class ordinal typology). Results were scored using a proximity metric that rewards near-correct predictions rather than requiring exact matches.

The headline: Qwen2.5-VL-32B with advanced reasoning achieved the highest overall proximity of 88.0%, with motor vehicle count reaching 95.0% within plus or minus one of the human value. But the more interesting finding is that scale did not predict quality. The 7B Vicuna-based LLaVA scored 83.1% and outperformed the 34B model, which ranked last at 62.2%, with particularly poor sidewalk detection at 15.8% accuracy.

Chain-of-thought reasoning was also not uniformly helpful. Qwen 32B gained 4.7 percentage points overall in reasoning mode, driven by a 19.5 point improvement on frontage length estimation, while several LLaVA models actually degraded because verbose reasoning introduced parsing failures. LLaMA3 LLaVA 8B in reasoning mode had a 10.9% NA rate (parser failed to extract an answer) and a 16.8% truncation rate, meaning the CoT trace got cut off on 101 out of 600 task-image pairs. Qwen models, by contrast, hit zero parsing failures and zero truncation on the 32B reasoning run.

When it is worth reaching for

UVLM is not a training framework or a novel architecture. It is a benchmarking and inference harness aimed at people who want to pick the right VLM for a domain-specific task without maintaining two codebases. The built-in task types (numeric, category, boolean, text) and modular prompt structure (role + task + theory + format) make it particularly useful when you need structured outputs that will feed a CSV or downstream pipeline, in domains like:

  • Remote sensing and land-use classification from satellite imagery
  • Medical image triage where the same prompt needs to be tested across models
  • Infrastructure inspection with counting or defect classification
  • Any task where output stochasticity is a real problem and majority voting adds reliability

The main caveats are honest ones from the paper itself. The largest checkpoints, Qwen2.5-VL 72B and LLaVA-NeXT 72B and 110B, exceed single-GPU memory even with 4-bit quantization and require multi-GPU setups beyond free-tier Colab. True multi-GPU batching is not yet implemented. And Qwen2.5-VL-3B on a T4 experienced intermittent CUDA device-side assertion failures because the T4 supports only FP16 while Qwen models are trained in BF16, so if you want the smallest Qwen you probably want an L4 or A100.

The code is Apache 2.0 licensed and the benchmark dataset is available on Zenodo. The authors note that InternVL, BLIP-2, CogVLM, DeepSeek-VL, Molmo, and GLM-V integration is on the roadmap, along with video frame support and an API mode for cloud deployment.