A style SAE inside Qwen-Image's text encoder: what Qwen3-VL knows about style
A side project of chameleon, our attempt
at an open Midjourney --sref. Steering image models with
SAE features is unreliable, so this one is about reading, not steering:
which style concepts does the encoder that conditions Qwen-Image
represent, and are they separate from content?
Interactive explorer: Qwen3-VL Style Atlas. It has every style and content feature discussed here, with its top images, caption labels and style η², for layers 36 and 18.
TL;DR
- We trained top-k sparse autoencoders (16,384 features, k = 32) on Qwen3-VL image activations of 48,000 MegaStyle images from 6,000 styles. Qwen3-VL is the vision-language model Qwen-Image 2.1 uses as its text encoder.
- MegaStyle gives each image a ground-truth style group: 8 images rendered from one style prompt with different subjects. That lets us measure each feature's style η², the share of its variance explained by which style prompt made the image. Chance is .125.
- At the last layer (36), 165 features have η² > .5 and 386
have η² > .3, out of 2,835 that fire on at least 0.1 % of
images. They are clean, nameable looks:
- vintage polaroid frames;
- black-and-white ink mandalas;
- halftone screen print;
- splatter paint;
- pixel art;
- chibi stickers;
- 3D cartoon renders;
- a purple palette.
- Content features sit at chance. Examples: the Eiffel tower, fireplaces, tigers, pagodas, runway models, pianos. Each fires on its subject in any medium. So style and content are largely separable in the encoder's feature basis.
- Most features are neither: the median η² is exactly chance. Style is a sparse slice of what a captioning VLM represents.
- One architectural finding changes how to use this. Qwen-Image's DiT never reads Qwen3-VL's image-token states. The reference's VAE latents overwrite those rows, so image information reaches the DiT only through the text tokens after the image.
- Filtering doesn't work as a style control. We tried an SAE filter at layer 18 (keep style features, drop the rest). It lowered style transfer instead of removing content (§6).
1. Why an SAE, and why on Qwen3-VL
Chameleon tried to build a reusable style "cartridge" for Qwen-Image. One recurring question was what the model's own conditioning knows about style. Qwen-Image 2.1 conditions its DiT on hidden states of Qwen3-VL (36 layers, width 4096), and accepts reference images through the same encoder. If style lives in identifiable directions there, it could be read out, compared across references, or even filtered.
We chose Qwen3-VL over the DiT's own activations for three reasons:
- It is the conditioning encoder. It is what turns a reference image into something the DiT can use.
- It is cheap. Caching it needs only the encoder, with no denoising loop and no noise level to pick.
- The data comes labelled. MegaStyle (tencent/MegaStyle-1.4M; we use the MegaStyle++ shards) was generated by Qwen-Image from about 170k structured style prompts × 400k content prompts, 8 images per style. That gives free style groups and free captions to label features with.
The circularity is worth stating up front: MegaStyle is Qwen-Image's own output distribution. That suits a study of Qwen-Image's encoder, and it limits how far the findings generalise to human-made art.
2. Setup
Activations. Each image is center-cropped to 512 px, which becomes 256 image tokens after Qwen3-VL's 2×2 merge. It is passed alone through Qwen-Image's chat template with an empty prompt, exactly as Qwen-Image loads the encoder. Forward hooks cache two layers:
- Layer 36: the input to the final norm, which is where Qwen-Image takes its conditioning states.
- Layer 18: the middle of the stack.
Per image we keep the mean over image tokens plus 8 random image tokens, stored as f16.
Data.
| Pilot | Scale-up | |
|---|---|---|
| Images | 8,000 | 48,000 |
| Styles | 1,000 (one contiguous slice of one shard; MegaStyle is sorted by style, so it was noir-heavy) | 6,000 (2,000 random styles from each of shards 00013, 00040, 00080) |
| Images per style | 8 | 8 |
| SAE | m = 4,096, k = 32, 60 epochs | m = 16,384, k = 32, 20 epochs |
SAE. Top-k SAE (Gao et al. 2024).
- Inputs are centred and scaled to E‖x‖² = d.
- z = topk(ReLU(W_e(x − b_d) + b_e), k), with unit-norm decoder columns.
- Loss: fraction of variance unexplained (FVU), plus an aux-k term (1/32) that reconstructs the residual from the top dead latents to keep them alive.
- 2 % of images are held out.
- Training uses both the per-image means and the individual tokens.
Style η². For each feature, take its activation on every image's mean vector and compute the share of variance explained by the style group (one-way ANOVA η²).
- With 6,000 groups of 8 the chance level is about (G − 1)/(N − 1) ≈ .125.
- η² near 1 means the feature fires on all 8 images of some styles and on none of the others, whatever their subject.
Labels. Each feature's top-50 images are scored phrase by phrase against MegaStyle's structured style prompts:
- Each comma-separated phrase is filed under its field: genre, palette, lighting, pattern, surface, edge or medium.
- Each word of the content caption is scored the same way.
- The score is precision × log(precision / base rate), with at least 5 hits.
Plain log-odds, used in the pilot, kept picking rare lighting phrases; weighting by precision fixed that.
3. Results
| Pilot L36 | Pilot L18 | Scale-up L36 | Scale-up L18 | |
|---|---|---|---|---|
| held-out FVU | .36 | .25 | .28 | .010* |
| live features | 3,792 / 4,096 | 2,261 | 7,307 / 16,384 | 1,543 |
| frequent (≥ 0.1 % of images) | 1,708 | — | 2,835 | 889 |
| style η² > .3 | 52 | 13 | 386 | 136 |
| style η² > .5 | — | — | 165 | 53 |
| median style η² | .128 | .128 | .125 | .127 |
* Layer 18's variance is dominated by a few very large "massive activation" channels. The SAE reconstructs those and looks near-perfect while capturing comparatively little of the rest, so its FVU is not comparable to layer 36's.
The distribution has two parts: a spike at chance (most features) and a long tail of style-consistent features that reaches .89. Scaling from 1,000 noir-heavy styles to 6,000 random ones grew that tail sevenfold at layer 36, and the labels became coherent across several caption fields.
3.1 Style features
What the tail contains:
- Media and techniques:
- halftone screen print (the dot texture the chameleon describer could name but never transmit);
- ink-line mandalas and coloring-book line art;
- splatter paint;
- pixel art;
- polygon-mesh and plastic-texture 3D renders;
- liquid-splash renders.
- Formats:
- vintage polaroid frames, split into four near-duplicate features;
- film-strip sprockets in the pilot.
- Genres:
- chibi sticker art with a thick outline;
- 3D cartoon characters;
- flat vector silhouettes.
- Palettes and patterns:
- a purple / pink / blue palette;
- camouflage;
- polka dots;
- plaid;
- floral and paisley wallpaper.
3.2 Content features
The content side mirrors the style side. Features for the Eiffel tower, fireplaces, tigers, fountains, pagodas, runway shows, pianos and barbells fire on their subject in whatever style it was rendered in. Their top images span the whole style range of the dataset, which is exactly what style η² ≈ chance means.
3.3 Layers
- Layer 36 is more style-separable than layer 18: 386 vs 136 features with η² > .3.
- Layer 18's SAE has far fewer live features, an effect of the massive-activation channels above.
- Pilot to scale-up, the change came almost entirely from data diversity: 6× the styles, sampled at random instead of one contiguous block.
- About 55 % of the 16k features are dead or rare at layer 36. For this much data a dictionary of 4–8k is enough.
4. What the encoder represents, and what reaches the image model
There is an architectural fact we only noticed while porting Qwen-Image. When a reference image is given:
- Qwen3-VL's states at the image-token positions
never reach the DiT. The DiT overwrites those rows with the reference's
VAE latents (
x[:, image] = img_in(latents)in the prefill). - The VL encoding of the reference therefore reaches the DiT only through the text tokens after the image slot. Those are the prompt tokens, which read the image inside the encoder.
So the layer-36 image-token features above are what Qwen3-VL represents about an image. They are not a channel the DiT reads directly. The channel the DiT does read is the prompt-token states, and those carry only part of it.
The chameleon ablation measured how much. With the reference given to the encoder only and the latents removed:
- the model does not copy subjects;
- style transfer drops to near the no-reference level (CSD .12 vs .41 with latents).
Almost all of a native reference's style, and all of its subject copying, rides on the VAE latents.
5. Caveats
- Synthetic, self-generated data. MegaStyle is Qwen-Image output. The features are features of Qwen3-VL on Qwen-Image's style distribution, and human-made art may split differently.
- Labels come from the generator's prompts. A label says which prompt phrase is over-represented among a feature's top images. That is a good naming signal but not a definition. A feature labelled "sharp edge" can be pixel art.
- η² measures consistency within a style prompt. It does not capture human style similarity. A feature tied to a recurring prop of one style prompt can score high without being "style".
- Per-image means. η² and the labels use the mean over image tokens. Spatially local features (a frame border, a signature) are diluted.
- Content η² is not measurable here. Content prompts barely repeat (1,568 repeats among 46,395, mostly pairs), so content η² sits near its own chance level.
- No causal tests. We read features. We did not ablate them inside the DiT's conditioning path, apart from the filter in §6.
6. A negative result: filtering the reference through the SAE
If style and content features separate, can we keep only the style features of a reference and get style without copying? Section 4 rules out acting on the final layer: the DiT never sees those states. So the filter acts on the reference's image tokens at layer 18, and layers 19–36 carry the change into the prompt tokens:
vl_recon: replace the tokens with the SAE reconstruction. This tests whether the encoder tolerates the SAE's error.vl_style: subtract every non-style feature (η² < .3), keeping the residual.vl_styleonly: keep only the 136 style features plus the decoder bias.
Results (VL-only reference, 11 references × 3 prompts, judged by CSD to the reference):
| Arm | t2i CSD | edit CSD | copy (DINO), t2i |
|---|---|---|---|
| no reference | .084 | .084 | .031 |
| VL only | .122 | .139 | .079 |
vl_recon |
.124 | .152 | .080 |
vl_style |
.096 | .119 | .072 |
vl_styleonly |
.092 | .128 | .073 |
- The encoder tolerates the SAE: the reconstruction matches the unfiltered arm.
- Removing "non-style" features removes style. CSD falls toward the no-reference level, so the filter doesn't isolate style.
Two likely reasons:
- At layer 18 only 136 features pass the η² threshold. Much of what makes a style is spread over features that also vary with content.
- In layers 1–18 the prompt tokens have already read the unfiltered image, so a mid-stack filter can't undo what leaked in before it.
A cleaner test would filter at several early layers. It would not change the main conclusion: with the latents removed, there is little style left to filter.
7. What it's good for
- Reading references. The top style features of a reference image name its look in the dataset's vocabulary: palette, medium, pattern. That is a transparent alternative to a black-box style embedding.
- Debugging transfer failures. The chameleon describer could say "small circular dots" for pointillism but never rendered them. The halftone and dot-matrix features show the encoder does represent dot textures, so the loss happened downstream: in the soft-token path, not in perception.
- A map of a model's style vocabulary. The explorer is the most useful artifact of the whole project: about 1,150 browsable features, each with images and labels.
Appendix: numbers and settings
- Cache: 48,000 images at 24 img/s on one A100, about 34 minutes; f16 activations, 9 vectors × 4,096 per image per layer.
- SAE: m = 16,384, k = 32, 20 epochs, Adam, aux-k 1/32, decoder columns renormalised every step.
- Style features: η² ≥ .2 and frequency ≥ 0.1 % (620 at layer 36, 208 at layer 18).
- Content features: η² < .2 with the strongest content-word labels (200 and 120 shown in the explorer).