FlexTok: Resampling Images into 1D Token Sequences of Flexible Length

Roman Bachmann, Jesse Allardice, David Mizrahi, Enrico Fini, Ouguzhan Fatih Kar, Elmira Amirloo, Alaaeldin El-Nouby, Amir Zamir, Afshin Dehghan

arXiv:2502.13967 · 2026-07-27 공개 · arXiv · PDF

transformer image-generation autoregressive-models fid-metric rectified-flow imagenet text-conditioned flextok

Abstract

Image tokenization has enabled major advances in autoregressive image generation by providing compressed, discrete representations that are more efficient to process than raw pixels. While traditional approaches use 2D grid tokenization, recent methods like TiTok have shown that 1D tokenization can achieve high generation quality by eliminating grid redundancies. However, these methods typically use a fixed number of tokens and thus cannot adapt to an image's inherent complexity. We introduce FlexTok, a tokenizer that projects 2D images into variable-length, ordered 1D token sequences. For example, a 256x256 image can be resampled into anywhere from 1 to 256 discrete tokens, hierarchically and semantically compressing its information. By training a rectified flow model as the decoder and using nested dropout, FlexTok produces plausible reconstructions regardless of the chosen token sequence length. We evaluate our approach in an autoregressive generation setting using a simple GPT-style Transformer. On ImageNet, this approach achieves an FID<2 across 8 to 128 tokens, outperforming TiTok and matching state-of-the-art methods with far fewer tokens. We further extend the model to support to text-conditioned image generation and examine how FlexTok relates to traditional 2D tokenization. A key finding is that FlexTok enables next-token prediction to describe images in a coarse-to-fine"visual vocabulary", and that the number of tokens to generate depends on the complexity of the generation task.

한국어 요약

한 줄 요약

FlexTok은 2D 이미지를 가변 길이 1D 토큰 시퀀스로 변환하여 효율적인 이미지 생성을 가능하게 하는 새로운 토크나이저이다.

핵심 기여도

핵심 아이디어

FlexTok은 기존의 고정 길이 1D 토큰화 방식과 달리, 이미지의 고유한 복잡도에 따라 토큰 수를 유동적으로 조절할 수 있는 새로운 토큰화 기법이다. 기존 TiTok과 같은 방법은 토큰 수가 고정되어 있어 복잡도가 낮은 이미지에도 동일한 수의 토큰을 할당하는 한계가 있었다. FlexTok은 ViT 인코더를 사용해 2D 이미지 패치를 1D 시퀀스로 매핑하고, FSQ(Finite Scalar Quantization)를 통해 이산화한 뒤, Rectified Flow 디코더와 Nested Dropout을 결합하여 토큰 수에 관계없이 의미 있는 복원을 가능하게 한다. 이는 토큰 시퀀스가 ‘coarse-to-fine’ 방식으로 이미지를 설명하는 ‘visual vocabulary’를 형성한다는 점에서 혁신적이다.

기술적 접근법

주요 결과

의의 및 한계

FlexTok은 이미지 생성의 계산 효율성을 높이고, 생성 과정을 ‘coarse-to-fine’ 방식으로 구조화함으로써 새로운 시각적 표현 패러다임을 제시한다. 특히, 토큰 수를 유동적으로 조절할 수 있어, 복잡도가 낮은 이미지에는 적은 토큰으로도 충분한 생성이 가능하다는 점에서 실용적 가치가 크다. 그러나, 고밀도 또는 구조화된 콘텐츠(예: 텍스트)는 더 많은 토큰과 의미 있는 학습 목표가 필요하다는 한계가 있다. 또한, 토큰 수에 따른 성능 변화를 정량적으로 평가하는 추가 연구가 필요하다.

실용적 활용

FlexTok은 이미지 생성 속도를 향상시키는 데 유용하며, 특히 텍스트 조건 기반 생성, 저용량 환경에서의 이미지 전송 및 저장, 그리고 비디오나 오디오와 같은 고밀도 데이터의 토큰화에도 확장 가능하다. 이는 생성 모델의 계산 예산을 적응적으로 관리하는 데 기여할 수 있다.