SHIFT

SHIFT: Steering Hidden Intermediates in Flow Transformers

Nina Konovalova1 Ibragim Idrisov2 Aibek Alanov3

1MBZUAI 2Lomonosov Moscow State University 3HSE University, FusionBrain Lab

WACV 2027
SHIFT suppresses unwanted concepts in FLUX.1 at inference time by adding a contrastive steering direction to the post-block text states of the double-stream blocks, gated by how relevant the concept is to the prompt. No diffusion-model weights are updated, one step-0 vector is reused for every denoising step, and vectors computed on the distilled FLUX.1[schnell] transfer directly to FLUX.1[dev].
Before and after pairs: glasses and a hat removed on Flux.1[schnell], nudity erased on Flux.1[schnell] (original censored), Snoopy erased while Pikachu is preserved on Flux.1[dev], and Van Gogh style erased on Flux.1[dev].
One mechanism, many edits. Each pair shows the unsteered generation and SHIFT with the same prompt and seed. * Flux.1[dev] steered with the vector computed on Flux.1[schnell]. Explicit regions are censored as in the paper.

Abstract

Diffusion models have become the leading approach for high-fidelity image generation, with recent DiT-based models achieving strong prompt adherence and high visual quality. However, removing unwanted concepts from these models typically requires expensive gradient-based fine-tuning, which is particularly prohibitive for multi-billion-parameter Diffusion Transformers and incompatible with distilled variants. We propose SHIFT, a simple model-weight-update-free inference-time framework for concept suppression in DiT models via targeted manipulation of intermediate activations at inference time, inspired by activation steering in LLMs. SHIFT learns steering vectors from contrastive prompts and applies them dynamically. We demonstrate that a single time-independent steering vector generalizes across all denoising timesteps and that vectors computed on a distilled model transfer effectively to its non-distilled counterpart without recomputation. SHIFT achieves strong concept suppression while preserving prompt fidelity and image quality. The same mechanism also enables flexible control — adding, removing, or changing objects and styles without retraining. SHIFT targets hosted inference settings: it does not remove the concept from the model weights and is therefore complementary to weight-level unlearning.

Method

SHIFT pipeline: (1) dataset construction from contrastive prompt pairs, (2) steering vector computation, (3) application at inference, (4) steering inside the diffusion transformer block.
Overview of the steering pipeline: (1) dataset construction from contrastive prompt pairs, (2) steering vector computation based on mean difference and separation plane, (3) application of the vector during inference, and (4) steering inside the diffusion transformer.

Where to steer: the post-block text state

In a FLUX double-stream block, text and image tokens are separate residual streams that interact through joint attention: \(X_t^{\ell+1} = X_t^{\ell} + R_{t,\ell}(X_t^{\ell}, X_i^{\ell}; e_\tau)\). Steering only the residual branch \(R_t\) by its exact source-to-target difference still leaves a mismatch, because the source-conditioned stream survives in the skip connection:

\[ X_t^{\ell+1,+} - \widetilde X_t^{\ell+1} = X_t^{+} - X_t^{-}. \]

Steering the post-block state \(X_t^{\ell+1}\) instead reconstructs the target activation exactly for a single contrastive pair, and with a mean direction over many pairs it performs approximate transport toward the concept-free region. Block outputs are also a standard interface across residual transformers, which makes the choice architecture-agnostic. As a complementary pathway, SHIFT also steers the pooled text embedding that forms the global modulation vector \(e_\tau\).

Diagram of a Flux.1 double-stream transformer block with the steering applied to the text-stream output.
Double-stream transformer block and the applied steering for Flux.1.

Steering vectors

For each concept we record activations for \(n\) prompt pairs \((p_k^-, p_k^+)\), where \(p_k^+\) inserts the concept into an otherwise neutral prompt (e.g. “an elephant” vs. “an elephant in cyberpunk style”), using the same seed for both. The per-token steering field is the mean difference, normalized per token:

\[ \Delta X_{\ell} = \frac{1}{n}\sum_{k=1}^{n}\left(X_{k,\ell}^{+} - X_{k,\ell}^{-}\right) \in \mathbb{R}^{T\times C}, \qquad v_{\ell,j} = \frac{\Delta X_{\ell,j}}{\lVert \Delta X_{\ell,j}\rVert_2 + \varepsilon}. \]

The field is computed only at the first denoising step and reused for all steps. At inference, \(\tilde X = X \pm \alpha\, v\), with \(-\) for suppression and \(+\) for addition. For the pooled text-encoder route we use the raw activation difference.

A shared cosine gate

Both routes are modulated by the same prompt-dependent cosine, which measures how relevant the target concept is to the current prompt. The text route clips it to [0, 1], the diffusion-transformer route to [0, δ]:

\[ \alpha_\text{pool} = \gamma_\text{pool}\, \operatorname{clip}\big(\cos\langle e_\text{init}, e_\text{target}\rangle,\, 0,\, 1\big), \qquad \alpha_\text{diff} = \gamma_\text{diff}\, \eta_\text{cls}\, c, \qquad c = \operatorname{clip}\big(\cos\langle e_\text{init}, e_\text{target}\rangle,\, 0,\, \delta\big), \]

where \(\eta_\text{cls} = \operatorname{clip}\big(\tfrac{1}{(1-p_\text{cls})+\varepsilon} - 1,\, 0,\, \eta_\text{max}\big)\) comes from a linear SVM fitted on token-mean activations of the same pairs, which estimates whether the concept is still present at the steered site. Steering vanishes when the concept is already weak or the prompt is unrelated. The gate is what lets several concepts be erased at once: each steering field keeps its own gate and activates only on its relevant prompts.

Key findings

Temporal invariance

A single steering vector computed at the first denoising step performs on par with per-step adaptation, so there is no per-step storage or recomputation.

Cross-distillation transfer

Vectors from the distilled FLUX.1[schnell] steer FLUX.1[dev] zero-shot: 156 vs. 152 I2P detections with dev's own activations (605 unsteered). Per-block cosine of the two nudity directions is 0.709 on average.

Intervention site

Post-block text states reach comparable or stronger suppression than steering the joint-attention output \(Y_t\), with less degradation of non-target concepts.

Prompt-selective gate

On MS-COCO the median effective strength is zero for four of the seven I2P concepts, with the gate fully closed on 43.9–77.0% of captions, so strength is spent only where the concept is present.

Results

Abstract concept erasure: nudity on I2P

I2P contains 4,703 prompts designed to elicit inappropriate generations. We count exposed body parts with NudeNet (threshold 0.6) at 512×512, and measure image quality on 5,000 MS-COCO captions.

Content note: the qualitative nudity figures show I2P generations; explicit regions are masked with red boxes, as in the paper.

MethodDetected nudity (quantity)MS-COCO 5K
CommonFemaleMaleTotal ↓FID ↓CLIP ↑
ESD2801212542631.8830.86
EAP3731751055832.0231.51
CA234981034231.8131.25
UCE232127536431.6531.55
EraseAnything281121640832.8931.35
SHIFT (γ=225)8333812431.8031.51
SHIFT (γ=250)71221210531.9131.50
Flux.1[schnell]4121901061231.6331.59

Flux.1[schnell]: NudeNet detections on I2P (left) and FID / CLIP on MS-COCO 5K (right). Best in bold, second underlined.

Grid of I2P generations on Flux.1[schnell]: rows are the original model, UCE, CA and SHIFT; explicit regions are masked with red boxes.
Qualitative comparison with baselines on Flux.1[schnell]. Rows from top to bottom: original generation, UCE, CA, and SHIFT.
MethodDetected nudity (quantity)
CommonFemaleMaleTotal ↓
CA2536526344
ESD32914532506
UCE1223912173
MACE1735528256
EAP2878613386
Meta-Unlearning35514026521
EraseAnything1294822199
SHIFT (dev acts)1182014152
SHIFT (schnell acts)1172514156
Flux.1[dev]40616138605

Flux.1[dev]: NudeNet detections on I2P. Baseline numbers are reported from EraseAnything. “schnell acts” uses a steering vector computed only from Flux.1[schnell] activations.

Grid of I2P generations on Flux.1[dev]: original model, SHIFT with the schnell-derived vector, and SHIFT with dev's own vector; explicit regions in the original row are masked.
Flux.1[dev] original and steered generation. * denotes that we use a steering vector from Flux.1[schnell] activations to steer Flux.1[dev].

Multi-concept erasure

A practical safety filter must suppress many concepts at once. SHIFT erases the seven inappropriate I2P categories jointly by summing their per-block steering fields, each modulated by its own cosine gate. Inappropriate content is detected with Q16 (an image is also counted if any exposed NudeNet class fires).

ClassInappropriate proportion (%) ↓
Flux.1[schnell]EraseAnythingSHIFT (γ=225)
Hate33.7728.578.37
Harassment32.4025.978.28
Violence35.9829.507.68
Self-harm41.4531.9616.54
Sexual50.7041.5720.78
Shocking47.9039.9515.45
Illegal activity34.3930.5412.29
Overall40.6333.6614.04
FID ↓ (COCO 5K)31.6332.7630.44
CLIP ↑ (COCO 5K)31.5931.2130.75

Inappropriate content removal on I2P with Flux.1[schnell], detected by the Q16 classifier.

Concrete concept erasure: Snoopy

Following the SPM protocol (80 prompts × 9 seeds), we erase Snoopy while preserving Mickey, Spongebob, Pikachu, dog and legislator. CLIP score (CS) should drop for the target and stay high for the preserved concepts; FID is measured against the original generations.

MethodSnoopyMickeySpongebobPikachuDogLegislator
CS ↓FIDCS ↑FID ↓CS ↑FID ↓CS ↑FID ↓CS ↑FID ↓CS ↑FID ↓
CA22.49168.3724.25129.9128.25131.7827.44129.5422.8696.9421.1883.83
SHIFT (γ=225)15.02259.0825.6370.6027.4075.6327.0353.9924.4764.9121.2856.63
SHIFT (γ=250)14.38281.3325.4672.2327.3474.8527.0054.1224.3664.8821.2856.63
Flux.1[schnell]28.01–26.72–27.94–27.15–24.62–21.89–

Concrete object erasure on Flux.1[schnell]. Results for Flux.1[dev] are in the paper's appendix.

Snoopy erasure: Flux.1[dev] with ESD and SHIFT on the left, Flux.1[schnell] with CA and SHIFT on the right. Pikachu is preserved while Snoopy is replaced by a statue.
Snoopy is erased while the related concept Pikachu is preserved, on Flux.1[dev] (left, against ESD) and Flux.1[schnell] (right, against CA). * denotes steering Flux.1[dev] with the vector computed from Flux.1[schnell] activations.

Small object removal

SHIFT also suppresses small local objects (glasses, hats, smiles) on Flux.1[schnell] with 4 steps. “%” is the mean fraction of images judged to contain the object by two blind annotators (120 images per concept). SHIFT redirects the model's generation trajectory; it is not a localized editing method and does not preserve pixel-level layouts.

MethodGlassesHatSmile
% ↓FID ↓CS ↑% ↓FID ↓CS ↑% ↓FID ↓CS ↑
SHIFT (γ=10)86.357.2730.7782.650.0831.6269.658.9531.38
SHIFT (γ=20)78.976.7031.0371.568.5531.8065.977.1631.40
SHIFT (γ=30)52.2104.1031.3047.887.0331.9647.493.9731.52
Flux.1[schnell]93.2–30.7490.0–31.5271.8–31.26

Remove-task steering on Flux.1[schnell].

Top row: original Flux.1[schnell] generations of people and a snake wearing glasses; bottom row: the same prompts steered so that the glasses disappear.
Steering to remove small concepts: glasses.

Style erasure

We remove a target artist's style (Van Gogh; Kelly McKernan) while preserving visually similar artists. Because styles are densely packed in embedding space, the style gate adds a hard cut-off \(\delta_1\): prompts with raw cosine below \(\delta_1\) are not steered at all (\(\delta_1 = 0.2,\ \delta = 0.5\)). Accuracy is the rate at which GPT-4o recognizes the artist.

MethodOld artistsModern artists
AccE ↓AccU ↑AccE ↓AccU ↑
Flux.1[dev]
ESD20.00%63.75%68.33%67.08%
SHIFT [dev]10.00%76.25%31.67%68.33%
SHIFT [schnell]20.00%76.25%31.67%67.50%
FLUX.1 [dev]68.33%79.58%88.33%81.25%
Flux.1[schnell]
UCE23.33%75.41%61.67%64.16%
SHIFT20.00%81.25%30.00%75.25%
FLUX.1 [schnell]80.00%84.59%88.33%85.84%

Style-erasure accuracy on old and modern artist groups. AccE: accuracy on erased-target prompts; AccU: accuracy on unaffected prompts.

Van Gogh style erasure on Flux.1[schnell] and Flux.1[dev]: sunflowers, wheat field with crows, windmill and sea, original vs UCE/ESD vs SHIFT.
Van Gogh style erasure. First row: original Flux.1[dev] and Flux.1[schnell] generations. Second row: UCE and ESD competitors. Last rows: our steered generations, where * denotes steering Flux.1[dev] with the vector derived from Flux.1[schnell].
Paintings in the styles of Picasso, Rembrandt, Warhol and Caravaggio, generated with and without Van Gogh steering, looking nearly identical.
Other artists' styles (Picasso, Rembrandt, Warhol, Caravaggio) are preserved while Van Gogh's style is erased.

Beyond erasure: adding and switching concepts

Applied with a positive sign, the same mechanism adds a concept or switches an attribute such as gender or age; no separate vector is needed for addition and removal.

Top row: original generations with neutral expressions; bottom row: steered generations with smiles.
Steering to add smile.

Beyond FLUX: Stable Diffusion 3.5

SHIFT also applies to another MM-DiT backbone, SD3.5 (pooled text-encoder strength 5, DiT block strength 50, gate bound \(\delta = 0.3\)).

MethodDetected nudityMS-COCO 5K
CommonFemaleMaleTotal ↓FID ↓CLIP ↑
SHIFT17662927.6031.74
SD3.5167811926728.2931.76

SD3.5, nudity on I2P.

MethodSnoopy CS ↓Mickey CSSpongebob CSPikachu CSDog CSLegislator CS
SHIFT18.8026.6628.7927.5924.5722.51
SD3.529.1926.7628.7827.5624.6222.50

SD3.5, Snoopy erasure (CLIP scores; FID values are in the paper).

Analysis

Here we look at the steering directions and the gate themselves rather than at the images they produce. Cosines are taken between per-block mean-difference steering vectors.

Cross-distillation transfer

Why does a vector computed on the distilled Flux.1[schnell] steer Flux.1[dev] without recomputation? The nudity directions estimated independently on the two models are closely aligned in every double-stream block: the mean cosine is 0.709 and the minimum 0.537, against 0.251 for a different concept and 0.000 ± 0.018 for random directions, so the concept occupies nearly the same direction in the text stream of both models. Blocks 0 and 18 are outliers on both curves and carry a component that is not concept-specific.

Line plot of per-block cosine between nudity directions from Flux.1[schnell] and Flux.1[dev].
Per-block cosine between the nudity direction computed on Flux.1[schnell] and on Flux.1[dev].

Geometry of concepts

The six inappropriate I2P categories point in almost the same direction (pairwise cosine 0.81–0.96, mean 0.886), while every pair between them and a concrete object is negative (−0.30 to −0.13); the two ranges do not overlap. Summing near-collinear fields therefore moves the representation along essentially one shared axis instead of several independent ones, which is why erasing all categories jointly leaves MS-COCO FID intact.

Heatmap of pairwise cosine similarity between concept steering directions.
Pairwise cosine between steering directions, averaged over the 19 blocks. Random baseline: 0.000 ± 0.004.

Linear separability at the steering site

The classifier factor \(\eta_\text{cls}\) assumes that the presence of a concept can be read linearly from the post-block text states. A linear SVM on token-mean activations, evaluated on held-out contrastive pairs, confirms it: at the first denoising step the validation ROC-AUC averages 0.951 over all concepts and blocks, with a minimum of 0.771 at any single site, and Snoopy is perfectly separated in every block. Separability decreases at later steps, which matches where steering is effective and supports building all steering quantities from the first step.

Heatmaps of validation ROC-AUC of the linear classifier per block and denoising step for two concepts.
Validation ROC-AUC of the linear classifier over all blocks and denoising steps for two representative concepts.

How the gate behaves

The nominal strength \(\gamma\) is always multiplied by the gate, so it overstates what is actually applied. For a named object the gate acts almost as a binary switch: it saturates on 100% of Snoopy prompts but on only 1.5% of prompts with the five preserved objects. For an abstract concept it works mostly below saturation and opens far more often on I2P than on MS-COCO (29×–86× more saturated prompts). At \(\gamma = 225\) the median effective strength on I2P ranges from 0.69 to 10.90 across categories, while on MS-COCO it is zero for four of the seven and the gate is fully closed on 43.9–77.0% of captions. A single \(\gamma\) therefore transfers across concepts: the gate, not the operator, adapts the strength to each prompt.

Three bar charts describing gate saturation and effective steering strength on I2P, MS-COCO and the concrete-object protocol.
Gate behaviour on Flux.1[schnell]: (a) fraction of prompts at which the gate saturates on I2P vs. MS-COCO 5K; (b) effective strength \(\alpha_\text{eff}\) per concept, with the share of fully closed gates inside each bar; (c) the same for the concrete-object protocol.

BibTeX

@inproceedings{konovalova2027shift,
  title     = {SHIFT: Steering Hidden Intermediates in Flow Transformers},
  author    = {Konovalova, Nina and Idrisov, Ibragim and Alanov, Aibek},
  booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
  year      = {2027}
}