Feature Gate
Surgically remove or amplify one visual concept from any prompt
- conditioning
- CONDITIONING
Where Concept Steer adds a pre-trained direction, Feature Gate edits what's already in your prompt's conditioning. It decomposes your conditioning through a trained SAE, zeros out or scales specific features you name, and rebuilds - so "a dramatic portrait in soft light" can become "the same portrait minus the dramatic lighting feature" or "with the warm-tone feature doubled." This is the closest thing in ComfyUI to opening the text encoder and rewiring a few wires instead of re-prompting and hoping.
How it works
Mechanically it's a partial SAE round-trip, and the implementation is smart about it. It encodes your conditioning through the SAE to get sparse feature activations, builds a modified activation vector (suppressed features zeroed, amplified ones scaled), then computes delta = decode_sparse(z - z_modified) and subtracts that delta from the original conditioning. No full reconstruct-and-replace - it only adjusts the contribution of the features you touched, which keeps everything else pristine.
The work happens at the layer where the SAE lives, so the same rule as everywhere else in this pack applies: your layer/sae_expansion and the SAE you trained must agree. per_token mode (default) applies the gate per token, which is precise; turning it off mean-pools first - faster, blunter.
The inputs that matter
- conditioning - from your text encoder.
- sae_path - must match the SAE used in Feature Map.
- suppress_features - comma-separated indices to remove:
4821,12033,8192. You get these from Feature Map's output. - amplify_features -
index:scalepairs:4821:2.0doubles feature 4821,0.5halves it. Comma-separated for multiple. - gate_strength - 1.0 ≈ a visible ~30% of token norm effect, same framing as Concept Steer's strength. 0.5–2.0 is the sane starting band.
- sae_expansion / transcoder_repo - expansion must match your SAE, or use a pretrained transcoder repo and it auto-detects 64×.
- per_token - keep
trueunless you're chasing speed.
Output is a single CONDITIONING, so it replaces your text encoder's output on the way to the KSampler. The intended loop is: Feature Map (discover indices) → paste into Feature Gate → sample → repeat.
Installing
Pack-standard install: ComfyUI Manager search "Concept Steer", or clone https://github.com/Nynxz/ComfyUI-ConceptSteer into custom_nodes/ and restart. Needs a trained SAE (Train SAE node or a transcoder repo) and transformers/safetensors.
Common gotchas
- You need Feature Map first. Gate without indices is nothing - there's no "guess what to gate." The indices come from decomposing this conditioning with this SAE.
- Scale explosions. Doubling a feature that's already firing hard can overshoot fast. The tooltip's
index:scaleformat is exact - a bare number inamplify_featuresmeans "amplify by this scale" in a way that's easy to misread; use the documented4821:2.0form. - SAE mismatch breaks everything. Gate + Map must use the same SAE file, layer, and expansion, or you're editing indices that mean nothing.
- This isn't prompt surgery on content. It operates on the SAE's learned features, which are best at aesthetic/semantic dimensions (lighting, mood, texture), not at "remove the cat." Manage expectations accordingly.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | — | |
| sae_path | STRING | Absolute path to SAE weights (.pt file). Must match the SAE used in Feature Map. | |
| suppress_features | STRING | Features to SUPPRESS (remove from conditioning). Comma-separated indices: '4821,12033,8192'. Get these from the Feature Map node output. | |
| amplify_features | STRING | Features to AMPLIFY with custom scales. Format: 'index:scale' pairs comma-separated. Example: '4821:2.0,12033:3.0' — doubles feature 4821, triples feature 12033. Scale=0.5 halves the feature. | |
| gate_strength | FLOAT | 1.00–5 | Strength of the gating effect, scaled relative to conditioning magnitude (like the steer strength). 1.0 = visible effect (~30% of token norm). 2.0 = strong. 0.0 = no change. Try 0.5–2.0 range first. |
| sae_expansion | INT | 82–128 | SAE expansion factor (auto-detected for transcoders). 8x for trained SAEs, 64x for pretrained transcoders. |
| transcoder_repo | STRING | HuggingFace repo for pretrained transcoders (e.g. 'mwhanna/qwen3-4b-transcoders'). Auto-downloads on first use. Leave empty to use sae_path instead. | |
| per_token | BOOLEAN | true | Apply gating per-token (recommended). When disabled, uses mean-pooled features which is faster but less precise. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |