메뉴
HN
Hacker News • 9일 전

텍스트-이미지 모델 학습 3.6배 빠르게 하기

IMP
7/10
핵심 요약

Linum 개발팀이 VAE를 제거하고 압축을 DiT 자체에 통합한 JiT 기반의 새로운 인코더-디코더 구조(JiT-DDT)를 발표했습니다. 이를 통해 GPU 시간을 3.6배 절감하면서도 픽셀 수 4배의 이미지를 생성할 수 있었고, 코드와 모델 가중치는 Apache 2.0 라이선스로 공개되었습니다.

번역된 본문

TL;DR: Linum v2는 어텐션 컨텍스트 윈도우의 막대한 크기가 병목이었습니다. 720p, 5초 클립이 무려 11만 토큰이나 소모했습니다. 이를 비교해 보면, LLM은 사전학습의 97%에서 8천 토큰 미만의 샘플을 다룹니다. 어텐션 비용은 제곱에 비례하므로, 모델 학습을 가속화하는 가장 큰 지렛대는 컨텍스트 윈도우를 줄이는 것입니다. 대부분의 생성형 이미지·비디오 시스템은 잠재 확산 모델(LDM)입니다. LDM은 압축과 생성을 각각 독립적으로 학습된 모듈, 즉 변분 오토인코더(VAE)와 DiT(확산 트랜스포머)로 분리합니다. 최근 JiT 같은 픽셀 공간 모델은 유망한 대안으로 입증되었습니다. 두 모델을 하나로 줄이고, 확산 모델이 재구성을 위해 만들어진 잠재 공간에 의존하는 대신 생성에 특화된 잠재 공간을 직접 구축할 수 있게 합니다. 우리의 (이미지, 캡션) 데이터셋으로 학습했을 때 JiT는 정밀한 디테일을 생성하는 데 어려움을 보였습니다. 우리는 이 디테일을 복원하고 LDM 대응 모델보다 훨씬 효율적으로 학습하는 새로운 인코더-디코더 구조(JiT-DDT)를 제안합니다. Linum v2 베이스라인과 비교했을 때, JiT-DDT는 픽셀 수가 4배인 이미지를 생성함에도 불구하고 GPU 시간을 3.6배 적게 사용해 텍스트-이미지 모델을 학습합니다. 연구 공개: 모델 코드와 모델 가중치가 Apache 2.0 라이선스 하에 제공됩니다. 연구 성과를 커뮤니티와 공유함으로써 다른 사람들도 더 효율적인 학습 방법을 탐구하도록 장려하기를 바랍니다. 이것은 정식 모델 릴리스가 아니라 연구 산출물로 봐주시기 바랍니다. Linum v3를 향한 여정에서 이런 연구 체크포인트가 더 있을 예정이니 기대해 주세요. VAE 압축 벽에 부딪히다: 거의 모든 생성형 이미지·비디오 모델은 잠재 확산 모델(LDM)입니다. 여기엔 두 가지 핵심 구성 요소가 있습니다. 압축을 담당하는 변분 오토인코더(VAE)와 생성을 담당하는 확산 트랜스포머(DiT)입니다. 원시 픽셀 공간에서 작업하는 것은 너무 비싸기 때문에(특히 비디오의 경우), 먼저 RGB 픽셀을 더 적은 수의 토큰으로 줄일 방법이 필요하며, 이 역할을 VAE가 합니다. VAE는 압축과 재구성을 위해 학습됩니다. 구체적으로, 픽셀 공간 샘플을 확률적 인코더에 통과시켜 n차원 토큰을 출력하고, 이 잠재 토큰을 확률적 디코더에 통과시켜 다시 픽셀 공간으로 되돌립니다. LDM을 만들 때는 VAE를 별도로 학습한 뒤 고정합니다(즉, DiT에서 VAE로 그래디언트가 흐르지 않음). 이렇게 하면 DiT 학습 내내 잠재 공간이 정적으로 유지됩니다. VAE 인코더로 데이터를 임베딩하고, DiT가 VAE의 잠재 공간을 탐색하도록 학습시킨 뒤, VAE 디코더로 DiT가 생성한 잠재 토큰을 픽셀 공간으로 변환합니다. DiT의 어텐션 비용을 억제하려면 VAE에서 최대한 많은 토큰 압축을 끌어내야 합니다. 하지만 FLUX, Ideogram, Z-Image 같은 인기 오픈소스 텍스트-이미지 모델을 살펴보면 모두 16×16 토큰 축소에서 상한에 도달해 있음을 알 수 있습니다. 이는 몇 년 전 우리가 수행한 이미지-비디오 VAE 실험 결과와 일치합니다. 안타깝게도 표준 CNN VAE로 재구성 품질 저하 없이 얻을 수 있는 압축량에는 경험적 상한이 존재하는 듯합니다. 통합 모델로 공격적인 압축 잠금 해제하기: 지난 가을, Tianhong Li와 Kaiming He가 VAE를 완전히 버리고 압축 작업을 DiT 자체에 넘김으로써 32×32 토큰 축소를 달성한 논문(JiT)을 발표했습니다. 이런 토큰 수 축소 접근법이 특히 새로운 것은 아닙니다. 반세기 전이 아니라 반십 년(5년) 전에 비전 트랜스포머(ViT)를 위해 발명되었으며, DiT에 들어가기 전 토큰 시퀀스를 더 응축하기 위해 VAE와 흔히 함께 사용됩니다. Linum v2에서 우리의 VAE는 8×8(h×w) 압축과 16차원 잠재 변수를 제공했습니다. DiT의 베이스에서는 2×2 패치화(patchification)를 적용해 16×16 토큰 압축과 64차원 잠재 변수를 얻었습니다. 우리는 Linum v2에서 이를 사용했고 대부분의 모델도 마찬가지입니다.

원문 보기
원문 보기 (영어)
TL;DR Linum v2 was bottlenecked by the enormous size of its attention context window. A 720p, 5 second clip cost a whopping 110K tokens. To put that in perspective, LLMs see samples with fewer than 8K tokens for 97% of their pretraining . Attention is quadratic in cost, so the biggest lever we have to accelerate model training is pruning the context window down. Most generative image and video systems are Latent Diffusion Models (LDMs). They split compression and generation into independently trained modules: the Variational Autoencoder (VAE) and the DiT (Diffusion Transformer). Recently, pixel-space models like the JiT have shown to be a promising alternative. It reduces two models into one and allows the diffusion model to construct a latent space specifically for generation, rather than rely on one built for reconstruction. When trained on our (image, caption) dataset, the JiT seems to struggle to produce finegrained details. We propose a novel encoder-decoder architecture (JiT-DDT) that recovers this detail and trains much more efficiently than its LDM counterpart. Against our Linum v2 baseline, the JiT-DDT trains a text-to-image model with 3.6× fewer GPU-hours, even though it generates images with 4× the pixels. Research release Model code Model weights JiT-DDT code and model weights are available under the Apache 2.0 license. We hope that by sharing our findings with the broader community, we can encourage others to also explore more efficient training methods. This should be treated as a research artifact, not a full model release. Stay tuned for more research checkpoints like this, en route to Linum v3. Hitting the VAE compression wall Almost all generative image and video models are Latent Diffusion Models (LDMs). These have two key components, a Variational Auto Encoder (VAE) for compression and a Diffusion Transformer (DiT) for generation. Operating in raw pixels is too expensive (especially for video), so we first need to find a way to reduce RGB pixels into a smaller amount of tokens for the DiT. This is where the VAE comes in. It's trained for compression and reconstruction. Specifically, it pushes our pixel-space samples through a probabilistic encoder, spits out -dimensional tokens, and then pushes these latent tokens through a probabilistic decoder to land back in pixel-space. When building a LDM, you train the VAE separately and then freeze it (i.e. no gradient flow from the DiT into the VAE). This way the latent space stays static throughout the course of DiT training. You run the VAE's encoder to embed your data, train the DiT to traverse the VAE's latent space, and then transform the DiT-generated latent tokens into pixel space using the VAE's decoder. We want to eke out as much token compression as possible from the VAE, so that we can curb the cost of attention in our DiT. But if you take a survey of the popular open source text-to-image models like FLUX, Ideogram, and Z-Image, you'll notice that they all cap out at 16×16 token reduction. This aligns with our experiments on Image-Video VAEs from a few years ago . Unfortunately, it seems like there is an empirical ceiling on the amount of compression we can get out of a standard CNN VAE without degrading the reconstructions. Unlocking aggressive compression with a unified model Last fall, Tianhong Li and Kaiming He published a paper ( JiT ) that achieves 32×32 token reduction by throwing away the VAE altogether and pushing the compression task into the DiT itself. This approach to reducing token counts isn't particularly new. It was invented for vision transformers ( ViT ) half a decade ago, and it's pretty commonly paired with a VAE to further condense token sequences before they enter the DiT. In Linum v2, our VAE gave us 8×8 (h×w) compression and 16-dimensional latents. At the base of the DiT, we applied 2×2 patchification to get 16×16 token compression and 64-dimensional latents. We used it in Linum v2 and so do models like FLUX. So, why hasn't anyone tried this before? This feels like a free lunch. You get a (potentially) lossless way to cut down attention cost, and it's bone-dead simple. In early 2025, papers like VA-VAE demonstrated that DiTs struggle to learn from high dimensional inputs. There are small hacks like using an external model as a regularizer during VAE training (e.g. DINOv3) that (likely) enabled models like FLUX-2 to make the leap from 64 latent dimensions to 128 latent dimensions for their DiT. But, these strategies just kick the can down the road on a clear learnability problem within the DiT. Aggressive patchification explicitly pushes information into the channel dimension, so it triggers this instability. But as it turns out, this is not intrinsic to the architecture. Rather, it's downstream of the v-prediction, v-loss flow matching objective that everyone's been using to train diffusion models these past few years. A quick refresher on flow matching In old school 2022-era denoising diffusion ( DDPM ), we iteratively noise a sample and train a neural network to remove the noise. This way at inference time we can use our neural network to transform Gaussian noise into a sample from our data distribution over a sequence of steps. This formulation has a host of issues (e.g. oversaturation in generation , unstable learning , distillation collapse ), so in the intervening years the field has shifted away from it towards flow matching. In flow matching , we construct a straight line path between every sample in our data distribution and a sample of Gaussian noise: The path between noise and samples does not have to be straight. But in practice, we all do it. At , we recover . At , we get , where . We follow the DDPM convention throughout this post: is data, is noise. Some flow matching papers run the other way, with as noise and as data. The two formulations are equivalent. Then we train a network to approximate the velocity along that path: We call this v-prediction, v-loss because the neural network is explicitly predicting velocity and it's trained on the MSE between its velocity prediction and the ground-truth, conditional velocity field. V-prediction and the curse of dimensionality If you're training a flow matching model you don't necessarily need to train your neural network to predict and regress velocity. The three terms are linearly re-arrangeable; so you can mix and match , , and across prediction and regression targets: In JiT, Li and He revisited the v-prediction, v-loss decision that the field's been making since the inception of flow matching. They took a toy distribution (points on a spiral) and then projected these points from 2D to different high dimensional spaces of increasing size. For each of these spaces, they trained flow matching models with x-prediction, -prediction, and velocity-prediction; and found that the x-prediction was the only model type to accurately generate samples from the spiral distribution at large dimensions. DiTs have been struggling to learn from high-dimensional inputs because of the curse of dimensionality. Velocity is . When we do v-prediction, our neural network has to implicitly learn the signal ( ) and noise ( ). Noise is a random Gaussian that will cover the entire -dimensional space. So, as we scale the problem of fitting noise (within the velocity term) becomes exponentially harder. This is why aggressive patchification failed in the past and why LDMs have been struggling to learn from high-dimensional VAE latents. As we grow the channel dimension, we end up in the degenerate case where our DiT is struggling to learn high dimensional Gaussian noise. By switching to x-prediction, we can try to side-step the curse of dimensionality. If we believe that images and videos naturally lie on a low dimensional manifold, we should be able to have our models predict effectively even with high . Empirically this works, if you do x-predictio