WEBVTT

00:00:00.870 --> 00:00:01.947
Hi, I'm Tortilla!

00:00:01.947 --> 00:00:04.819
Sana is known as the linear-attention image model.

00:00:04.819 --> 00:00:08.049
But its bigger trick happens before attention even runs.

00:00:08.049 --> 00:00:09.485
Here's how it works.

00:00:10.725 --> 00:00:15.321
Sana's autoencoder compresses thirty-two times per side, with patch size one.

00:00:15.321 --> 00:00:20.334
So the transformer sees four times fewer tokens, before any attention runs.

00:00:22.342 --> 00:00:25.823
A diffusion transformer works on an autoencoder's latents.

00:00:25.823 --> 00:00:31.044
FLUX and SD3 shrink each side eight times, then patch by two:

00:00:31.044 --> 00:00:34.090
a 1024 pixel image becomes 4096 tokens.

00:00:34.510 --> 00:00:39.446
Sana's autoencoder shrinks each side thirty-two times, with no patching on top.

00:00:39.446 --> 00:00:43.971
The same image is a thirty-two by thirty-two grid: 1024 tokens.

00:00:44.391 --> 00:00:46.146
The transformer denoises that grid.

00:00:46.146 --> 00:00:51.062
Its self-attention is linear, so cost grows with the token count, not its square.

00:00:51.482 --> 00:00:56.394
The prompt goes through Gemma, a small language model with its head removed.

00:00:56.394 --> 00:00:59.416
The transformer reads it through ordinary softmax cross-attention.

00:01:00.775 --> 00:01:03.130
Softmax attention builds a token-by-token matrix.

00:01:03.130 --> 00:01:08.625
Swap the exponential for a ReLU, and you can multiply in a different order.

00:01:09.045 --> 00:01:10.562
Keys times values first.

00:01:10.562 --> 00:01:15.493
That's a small thirty-two by thirty-two state, the same size at every resolution.

00:01:15.912 --> 00:01:19.043
Then each query reads that state, so the cost is linear in

00:01:19.043 --> 00:01:20.087
the number of tokens.

00:01:21.383 --> 00:01:26.144
Given the autoencoder, linear attention buys one point one two times at

00:01:26.144 --> 00:01:29.319
ten twenty-four pixels, and three at forty ninety-six.

00:01:29.319 --> 00:01:31.699
The autoencoder always buys about four.

00:01:32.850 --> 00:01:37.318
At every resolution Sana ships, the autoencoder is the bigger lever.

00:01:37.318 --> 00:01:40.974
Linear attention is insurance against the resolution going up.

00:01:42.900 --> 00:01:47.377
To recap: compress harder before the transformer, keep attention's state small, and

00:01:47.377 --> 00:01:49.243
know where each lever pays.

00:01:49.663 --> 00:01:51.877
Every source is in the full article.

00:01:51.877 --> 00:01:52.510
I'm Tortilla.

00:01:52.510 --> 00:01:52.826
Bye!
