#!/bin/bash # ============================================================================= # gradient_ascent.sh — bathroom→toilet causal influence map via probe gradient. # # For each BATHROOM-ONLY image (bathroom=1 & toilet=0): nudge the residual stream # at layer l along ĝ = ∂ score_bath_l/∂ h_l (unit gradient ascent in the bathroom # direction), step scaled by ALPHA*‖h_l‖ so ALPHA is a fraction of the residual norm # (comparable across layers), propagate, and measure Δ toilet score at every layer # l' >= l. Averaged → heatmap (intervention layer l × readout l'). # # Tunables (override inline, e.g. ALPHA=2 NUM_IMAGES=128 bash