use case · wild Xenova/yolos-small · q8 WASM O(N²) attention curve · stress suite

Quadratic Attention Lab: Resolution Scaling & Perturbation Stress

Because YOLOS-Small applies global self-attention across every 16×16 patch in all 12 layers, halving the input short-edge cuts patches by ~4× and self-attention pairs by ~15×. Sweep 320 → 480 → 640 → 800 px live on your own photo to measure the real O(N²) latency curve and recall trade-off, then stress-test lighting, blur, and crop perturbations.

1 · Choose a photo & input resolution

Loading a sample photo…

2 · Empirical O(N²) patch-count vs latency curve

Each point runs a real forward pass in the Web Worker with YolosFeatureExtractor.size set to the target short-edge. Recall is measured against the 800 px full-resolution detections (same-class IoU ≥ 0.45).

Points measured0 / 4
320 → 800 speedup–
Quadratic fit R²–
Slope (ms / M pairs)–
Measured resolution sweep (real WASM runs on this device)
Short edge Input dims Patches (16×16) Total tokens (T) Latency Boxes ≥ thr Recall vs 800 px
Run the 4-point sweep (or run individual edges) to populate measurements.
Show the code — per-run YolosFeatureExtractor resolution override in the worker
Show the code — empirical O(T²) linear regression fit

3 · Perturbation stress test (low light, blur, contrast, centre crop)

Applies real offscreen canvas transforms to the active photo and measures detection recall and mean confidence drift relative to the clean run at the selected short-edge.

Uses the selected short-edge above (480 px keeps all 5 passes around ~15 s).
Live perturbation stress results
Preset Latency Boxes ≥ thr Matched baseline Score drift Top labels
Press "Run 5-preset stress suite" to measure drift.
Show the code — canvas filter and centre-crop stress generator