At a glance
| Upstream model | openai/clip-vit-large-patch14 (MIT) |
|---|---|
| ONNX export |
Xenova/clip-vit-large-patch14
(onnx/model_quantized.onnx)
|
| Task / pipeline | zero-shot-image-classification (shared Transformers.js 3.7.5 via lib/webai.js) |
| Architecture |
CLIPModel β 24-layer ViT-Large/14 vision encoder (1024-d, 16 heads, 14Γ14px patches, 256 spatial tokens, ~304M vision params) +
12-layer text encoder (768-d, 12 heads, max 77 tokens) β 768-d shared projection
|
| Quantisation & size | q8 INT8 default (432.09 MB / 432,090,204 B Β· 412.07 MiB); optional q4 (400.74 MB) & q4f16 (297.84 MB) |
| Backend & memory | WebAssembly (wasm) β ~432 MB download; mobile devices with tight RAM limits may take longer or prefer lighter sibling ViT-B/16 |
| Web APIs | Web Workers, Cache Storage, Canvas 2D, Clipboard, MediaDevices (all Baseline) |
Run it β Live Open-Vocabulary Classifier
Loading curated starter photoβ¦
See inside β 768-d Cosine Similarity Matrix & Logit Scale
ViT-Large/14 projects both the 256 spatial image patches (plus [CLS]) and each
wrapped prompt into unit-normalized 768-d vectors. Below are the exact
raw cosine similarities, logit_scale (learned β100.0Γ) logits,
softmax probabilities, and the pairwise text-to-text cosine similarity matrix from your run.
| # | Label | Wrapped prompt | 768-d cosine | Scaled logit | Softmax % |
|---|---|---|---|---|---|
| Run a classification above to inspect raw 768-d cosines and logits. | |||||
| Run a classification above to inspect the NΓN prompt cosine matrix. |
Show the code β CLIP ViT-Large/14 worker coalesced load & epoch cancellation
Show the code β Zero-shot inference, 768-d cosines & pairwise matrix in worker.js
Show the code β analyzeZeroShotResult() NaN audit, entropy, and logit_scale fit
Why ViT-Large/14 matters
Smaller CLIP checkpoints (ViT-B/32 with 49 patches, or ViT-B/16 with 196 patches) compress images into 512 dimensions and miss subtle textures or small objects. ViT-Large/14 doubles depth to 24 layers and encodes 256 14Γ14px tokens into 768-d space:
- Higher fine-grained separation β resolves subtle material, craft, and species cues without task-specific training.
- Zero-server privacy β sensitive catalog images, medical reference frames, or personal archives stay in the visitor's tab.
- Inspectable calibration β exposes raw 768-d cosines separately from the sharp
100Γsoftmax amplification. - Head-to-head trade-off clarity β test directly against lightweight sibling CLIP ViT-Base/16 on the Multi-model route.
Use-case ladder
Basics: Patch-14 & Calibration
Inspect the 16Γ16 (256-token) Patch-14 grid, prompt-framing sensitivity, and T=1.0 vs logit_scale calibration.
Practical: FIFO Album Tagger
Batch-tag multi-photo uploads, webcam snaps, and all curated scenes with concept search and CSV/MD/JSON exports.
Wild: Adversarial Prompt Traps
Probe typographic attacks, texture crops, blur, low light, and conflicting distractors with mid-suite Cancel.
Multi-model: ViT-L/14 vs ViT-B/16
Pit CLIP ViT-Large/14 (768-d, 14px patches) live against sibling CLIP ViT-Base/16 (512-d, 16px patches).
How the API works
CLIP ViT-Large/14 runs via the standard Transformers.js zero-shot-image-classification pipeline inside a module Web Worker:
import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.5";
const classifier = await pipeline(
"zero-shot-image-classification",
"Xenova/clip-vit-large-patch14",
{ device: "wasm", dtype: "q8" },
);
const scores = await classifier(image, ["a dog standing on grass", "a pizza on a plate"], {
hypothesis_template: "a photo of {}",
});