use case · basics · token anatomy & register-token lab · DINOv3 License

Token Anatomy, Register Tokens & Geometric Invariance Lab

DINOv3 ViT-S/16 emits 201 tokens per 224×224 image: 1 global [CLS] token (idx 0), 4 register tokens (idx 1..4), and 196 spatial patches (idx 5..200). Inspect their L2 norms side-by-side, threshold foreground-only PCA live, and verify self-supervised representation invariance under horizontal flips and 75% center crops.

1. Initialise DINOv3 & Choose an Image

Initialise DINOv3 above to dissect [CLS], the 4 register tokens, and the 196 spatial patches.

2. [CLS] vs 4 Register Tokens vs 196 Spatial Patches

Token L2 Norms & Register Absorption

Register tokens absorb elevated global norms (typically 1.2–1.6× patch median) so spatial patches stay uniform and artifact-free.

Exact per-register norms and cosine alignment to [CLS]
Token Slice Sequence Index L2 Norm Cos to [CLS]
Run token dissection to inspect exact tensor norms.

Foreground vs Background PCA Thresholding

Threshold PC1 to separate foreground object patches from background, then fit 3-channel RGB PCA strictly on the foreground patches (DINOv2/DINOv3 paper method).

Waiting for DINOv3 patch embeddings…

3. Geometric Invariance: Original vs Horizontal Flip vs 75% Center Crop

Self-supervised DINOv3 learns view-invariant descriptors by training student/teacher views across crops and flips. Click Run Flip & Crop Invariance Test to run three real on-device forward passes and measure exact cosine retention.

Original

–

Horizontal Flip (Mirror)

–

75% Center Crop

–

Live geometric invariance measurements across three real DINOv3 forward passes
Perturbation [CLS] Cosine vs Orig Mean Patch Cosine vs Orig Patch Max/Med Norm Latency
Click "Run Flip & Crop Invariance Test" to measure live invariance.

4. Under the Hood — Exact Worker Code

Inspect the exact off-main-thread Web Worker functions in worker.js that load onnx-community/dinov3-vits16-pretrain-lvd1689m-ONNX on @huggingface/transformers@4.3.0 and unpack the [1, 201, 384] hidden state while skipping indices 1..4.

Show the code — extractFeatures() [1, 201, 384] forward pass & register-skipping unpack
Show the code — ensureLoaded() coalesced GPU probe, WebGPU q4 / WASM q8 fallback & epoch guards