Instructions to use kinasr/visual-verdict-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kinasr/visual-verdict-2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="kinasr/visual-verdict-2b", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("kinasr/visual-verdict-2b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kinasr/visual-verdict-2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kinasr/visual-verdict-2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kinasr/visual-verdict-2b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/kinasr/visual-verdict-2b
- SGLang
How to use kinasr/visual-verdict-2b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kinasr/visual-verdict-2b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kinasr/visual-verdict-2b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kinasr/visual-verdict-2b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kinasr/visual-verdict-2b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use kinasr/visual-verdict-2b with Docker Model Runner:
docker model run hf.co/kinasr/visual-verdict-2b
- Visual Verdict 2B (
kinasr/visual-verdict-2b) ๐ฏ
Visual Verdict 2B (kinasr/visual-verdict-2b) ๐ฏ
Visual Verdict 2B is a specialized System 1 Typed-Decision Vision-Language Model fine-tuned for Automated Web Visual Regression Testing & UI Triage.
Built on top of LiquidAI/d1-2B (powered by the LFM3-VL-2B tri-hybrid architecture), Visual Verdict 2B evaluates pairs of web screenshots (Baseline Reference vs. Current Render) alongside structured browser telemetry (app_state) and outputs temperature-calibrated probabilities in a single forward passโwithout autoregressive token generation, JSON formatting errors, or pipeline hallucinations.
โจ Why Visual Verdict 2B?
Traditional pixel-diffing tools fail on harmless dynamic updates (timestamps, counters, benign text changes) and provide zero diagnostic context on what broke. Conversely, generative VLMs suffer from high latency and unstable outputs in CI/CD pipelines.
Visual Verdict 2B bridges both worlds:
- โก Single Forward-Pass Decisions: Evaluates
[Reference Image + Current Image + Browser DOM Telemetry]viaSlotReaderin milliseconds without generating text tokens. - ๐ฏ 6-Class Semantic Triage: Classifies visual diffs into 5 actionable QA outcomes plus an explicit Unknown / Needs Human Review gate:
- Pass (No visual regression): Includes exact re-renders and benign dynamic data changes (
benign_dynamic). - Layout shift, overlap, or misalignment: Flex/Grid breaks, colliding components, or unintended flow offsets.
- Missing interactive element or CTA: Disappeared buttons, inputs, or navigation slots (
inert_navigation_slot,inert_control_slot). - Broken CSS styling or unreadable contrast: Corrupted design tokens, typography breaks, or unreadable text contrast across Light & Dark themes.
- Broken image, icon, or media asset: Client-side media render failures, broken SVGs/icons, or unloaded thumbnails.
- Unknown (Ambiguous / Needs Human QA Review): Cookie consent banners (
consent_interception), loading overlays/skeletons (loading_interception), incomplete captures (incomplete_capture), or full route mismatches (page_route_mismatch).
- Pass (No visual regression): Includes exact re-renders and benign dynamic data changes (
- ๐ก๏ธ Calibrated Confidence Scores: Post-trained with LBFGS temperature scaling (
calibration.json) on held-out validation logits so CI/CD pipelines can safely auto-gate high-confidence verdicts and route uncertain edge cases to human QA engineers.
๐ Benchmark & Evaluation Results
Evaluated under matched settings (640px image cap, 4 cyclic option rotations, MPS float16, native SlotReader temperature calibration, and zero pixel short-circuiting) across both the Out-of-Distribution (OOD v3, 360 pairs) benchmark and the historical dataset-v2 (300 pairs) test split:
1. Overall 6-Class Accuracy & Latency
| Model | OOD v3 (360 pairs) | Historical v2 (300 pairs) | Binary Pass/Defect (OOD v3) | Binary Pass/Defect (v2) | OOD Mean Latency (s)* | v2 Mean Latency (s)* |
|---|---|---|---|---|---|---|
kinasr/visual-verdict-2b (Ours) |
76.9% (277/360) | 58.7% (176/300) | 91.9% | 97.0% | 3.143s | 2.888s |
kinasr/imajev-2b-web-visual-testing |
61.4% | 76.3% | 89.7% | 97.0% | 4.973s | 7.496s |
LiquidAI/d1-2B (Base Zero-Shot) |
35.6% | 43.0% | 58.3% | โ | 3.081s | 3.305s |
LiquidAI/LFM3-VL-2B (Zero-Shot) |
16.9% | 18.0% | 19.4% | โ | 3.460s | 3.137s |
pixel-diff (Traditional Baseline) |
25.0% | 33.3% | โ | โ | 0.023s | 0.020s |
*Latency covers all 4 cyclic option rotations and image preprocessing on Apple Silicon MPS (float16), excluding model loading (~0.75s per single forward pass).
Key Takeaways:
- State-of-the-Art OOD Generalization:
visual-verdict-2bleads the unseenOOD v3benchmark at 76.9%, outperformingimajev-2b-web-visual-testingby +15.56 percentage points and improving over its baseLiquidAI/d1-2Bmodel by +41.39 points onOOD v3(and +15.67 points onv2).- 1.6xโ2.6x Faster Inference: Thanks to the
LFM3-VL-2Btri-hybrid backbone,visual-verdict-2breduces end-to-end 4-rotation evaluation latency from4.97sโ7.50sdown to2.89sโ3.14s.- Note on Historical
v2Split:dataset-v2is a historical evaluation set whose training distribution was used to trainimajev-2b-web-visual-testing(in-distribution for Imajev, out-of-distribution for thisv3-trained checkpoint). Even without seeingv2domains,visual-verdict-2bachieves 97.0% binary Pass/non-Pass accuracy onv2.
2. Per-Class Recall (kinasr/visual-verdict-2b)
| Canonical Class | OOD v3 Recall (60/class) | Historical v2 Recall (50/class) |
|---|---|---|
| Pass (No visual regression) | 60.0% | 100.0% |
| Layout (Shift, overlap, misalignment) | 90.0% | 60.0% |
| Missing (Missing interactive element / CTA) | 81.7% | 68.0% |
| Styling (Broken CSS or unreadable contrast) | 70.0% | 24.0% |
| Asset (Broken image, icon, or media) | 100.0% | 64.0% |
| Unknown (Ambiguous / Needs Human Review) | 60.0% | 36.0% |
3. Confidence Calibration & Paired Outcomes
- High-Confidence Gating (
OOD v3): At confidence $\ge 0.90$, the model covers 77.8% of the benchmark with 84.3% empirical accuracy (ECE = 0.1556,Brier = 0.3797). - Head-to-Head vs.
imajev-2b-web-visual-testing(OOD v3): Out of 360 pairs, both models agreed on 196 correct predictions;visual-verdict-2buniquely solved 81 pairs missed by Imajev, while Imajev uniquely solved 25 (+56 net pair advantage).
๐๏ธ Model Architecture & Repository Structure
| Property | Specification |
|---|---|
| Base Architecture | LiquidAI/d1-2B (LFM3-VL-2B Tri-Hybrid: 13 Gated Short Conv + 5 Sliding Window + 6 Global Attention layers) |
| Parameters | 1.92B |
| Vision Encoder | 164M Native-Resolution Vision Tower |
| Fine-Tuning Method | Merged LoRA (r=16, lora_alpha=32) over unfused language projections (q_proj, k_proj, v_proj, out_proj, in_proj, gate_proj, w1, w2, w3) |
| Training Dataset | dataset-v3-train (1,800 training + 240 validation browser-rendered UI pairs across Light/Dark themes and 18 fine-grained regression subtypes with strict DOM telemetry parity) |
| Weights Format | Standalone merged model.safetensors (bfloat16) + original LoRA adapter backup in ./lora_adapter/ |
๐ Quickstart & Inference
1. Installation
pip install -U "transformers>=5.19.0" accelerate safetensors pillow torch torchvision
2. Running a Visual Regression Verdict in Python
import sys
import json
import torch
from PIL import Image
from transformers import AutoModel, AutoProcessor
MODEL_ID = "kinasr/visual-verdict-2b"
DEVICE = "cuda" if torch.cuda.is_available() else ("mps" if torch.backends.mps.is_available() else "cpu")
DTYPE = torch.float16 if DEVICE != "cpu" else torch.float32
# 1. Load processor and standalone fine-tuned model
processor = AutoProcessor.from_pretrained(MODEL_ID, trust_remote_code=True)
model = AutoModel.from_pretrained(
MODEL_ID,
trust_remote_code=True,
dtype=DTYPE,
).to(DEVICE).eval()
# 2. Initialize the d1 SlotReader decision engine
pkg_name = model.__class__.__module__.rsplit(".", 1)[0]
slots_mod = sys.modules[f"{pkg_name}.slots"]
engine = slots_mod.SlotReader(model, processor)
# 3. Prepare Reference & Current Screenshots + Browser Telemetry State
ref_img = Image.open("reference.png").convert("RGB")
curr_img = Image.open("current.png").convert("RGB")
app_state = {
"viewport": {"width": 1280, "height": 800},
"console_error_count": 0,
"failed_network_count": 0,
"visible_button_count": 6
}
options = [
"Pass (No visual regression)",
"Layout shift, overlap, or misalignment",
"Missing interactive element or CTA",
"Broken CSS styling or unreadable contrast",
"Broken image, icon, or media asset",
"Ambiguous, consent banner, loading overlay, or incomplete capture requiring human QA review"
]
criteria = {f"opt_{i}": text for i, text in enumerate(options)}
question = {
"type": "choice",
"instructions": "Compare the current screenshot against the baseline reference and classify the visual regression outcome.",
"criteria": criteria
}
# 4. Single forward-pass decision
result = engine.decide(
state=app_state,
questions={"visual_verdict": question},
images=[ref_img, curr_img]
)
print(json.dumps(result, indent=2))
๐ ๏ธ Recommended Production Pipeline (Hybrid CI/CD Gating)
- Fast Pixel Short-Circuit: Run a fast pixel compare first. If
pixel_diff == 0%, pass immediately in<5mswithout invoking the GPU. - Semantic AI Verdict: When
pixel_diff > 0%, pass the screenshot pair and browser state tokinasr/visual-verdict-2bto filter out benign dynamic content (false positives) and diagnose the exact defect category. - Confidence Routing: Auto-decide test runs when calibrated
confidence >= 0.75(or>= 0.90for strict gates), and route lower-confidence predictions orUnknownverdicts (e.g., cookie banners or loading spinners) to human QA review.
๐ Related Models in the Verdict & Visual Testing Suite
kinasr/imajev-2b-web-visual-testingโ Qwen3.5-2B / Imajev-based visual regression decision model.
๐ License
This model inherits the LFM Open License v1.0 from its base model LiquidAI/d1-2B.
- Downloads last month
- 7