| name | farmer-flow-autoregressive |
| title | FARMER: Flow AutoRegressive Transformer over Pixels |
| version | 0.0.2 |
| engine | skillxiv-v0.0.2-claude-opus-4.6 |
| license | MIT |
| url | https://arxiv.org/abs/2510.23588 |
| keywords | ["Generative Model","Autoregressive","Flow Matching","Pixels","Likelihoods"] |
| description | Generates high-quality images directly from pixels using flow-matching-based latent sequences. Transforms images via invertible flows into manageable latent sequences, applies autoregressive modeling, and uses classifier-free guidance. Provides exact likelihood estimates and one-step distillation capabilities. |
FARMER: Flow Autoregressive Model for Pixel Generation
Direct pixel-space autoregressive modeling fails due to sequence length and dimensionality. FARMER uses invertible flows to compress images into latent sequences, applying autoregressive modeling to the compressed space.
The flow-based approach provides exact likelihoods and enables efficient distillation to one-step generators.
Core Concept
Key innovation: decompose image generation into flow compression + autoregressive modeling:
- Invertible flow transforms images → manageable latent sequences
- Autoregressive transformer models latent sequence distribution
- Self-supervised dimension reduction identifies informative channels
- One-step distillation accelerates inference
Architecture Overview
- Normalizing flow encoder (invertible)
- Channel pruning for dimension reduction
- Autoregressive sequence modeling in latent space
- Classifier-free guidance for quality control
Implementation Steps
Implement an invertible flow that transforms high-dimensional images into sequences. Use coupling layers or masked autoencoders:
class InvertibleImageFlow(nn.Module):
def __init__(self, num_channels=3, flow_depth=8):
super().__init__()
self.flow_layers = nn.ModuleList([
CouplingLayer(num_channels, hidden_dim=128)
for _ in range(flow_depth)
])
self.log_scale = nn.Parameter(torch.zeros(num_channels))
def forward(self, images):
"""Transform images to latent sequences."""
batch_size = images.shape[0]
z = images
log_det_jacobian =
layer .flow_layers:
z, ldj = layer(z)
log_det_jacobian += ldj
z_seq = z.permute(, , , ).reshape(batch_size, -, z.shape[])
z_seq, log_det_jacobian
():
batch_size = z_seq.shape[]
num_channels = z_seq.shape[-]
H = W = (np.sqrt(z_seq.shape[]))
z = z_seq.reshape(batch_size, H, W, num_channels).permute(, , , )
layer (.flow_layers):
z = layer.inverse(z)
z