﻿# SigLIP2 NaFlex: an image aspect ratio changes the patch sequence

Choose SigLIP2 NaFlex preprocessing by tracking aspect ratio, patch budgets and padding instead of assuming every image becomes a fixed square tensor.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-siglip2-naflex-patch-budget-aspect-ratio/
Language: en

## Identify the selected image contract

SigLIP2 includes fixed-resolution and NaFlex variants. The [model documentation](https://huggingface.co/docs/transformers/model_doc/siglip2) describes NaFlex as supporting variable resolutions while limiting aspect-ratio distortion. This is an input-processing distinction, not a promise that an arbitrary image will be read perfectly. Select the intended checkpoint and processor together before deciding what a request's image size means for the application.

## Follow patches rather than only pixel dimensions

NaFlex resizes an image to patch-compatible dimensions and represents it as a patch sequence within a configured budget. The processor can pad that sequence and supplies information identifying valid positions. A wide product photograph and a tall document can therefore reach the encoder differently from a square crop. Inspect the resulting patch layout and mask when diagnosing missing detail or unexpected batch shapes.

## Preserve the checkpoint's preprocessing assumptions

The [NaFlex model card](https://huggingface.co/google/siglip2-base-patch16-naflex) identifies a concrete released artifact. Use its associated processor rather than substituting a familiar fixed-resolution transform from another model. If representations are cached, record the preprocessing and patch-budget settings with the cache version. Otherwise the same source image can silently acquire incompatible embeddings after a configuration change, even though the model weights have not moved.

## Evaluate the resolution decision on useful evidence

The [SigLIP2 paper](https://arxiv.org/abs/2502.14786) describes a broader vision-language training recipe. Its reported results do not establish the best patch budget for a new document collection. Build a sample containing narrow text columns, large margins and landscape photographs. Compare the evidence retained for the downstream task and measure the actual processing cost. A larger budget is a changed experiment, not an automatic quality guarantee.

## Connect image geometry to batching

A serving implementation should distinguish allocated sequence positions from useful image patches. Padding affects the tensor presented to a batched kernel, while the mask affects interpretation of valid inputs. The articles on [ViT patch sequences](/journal/vit-image-patches-token-sequence/) and [ragged-batch padding](/journal/learn-ragged-batch-padding-masks/) explain these adjacent mechanisms. For SigLIP2 NaFlex, the operational record should additionally preserve checkpoint family, image processor and patch budget so image geometry remains reproducible across runs.
