#!/bin/bash # ============================================================================= # integrated_gradient.sh — bathroom→toilet causal influence map via INTEGRATED # GRADIENT of the bathroom probe (replaces gradient_ascent.sh's local-grad steer). # # Steered direction at layer l = integrated gradient of score_bath_l along the # straight path base→image, where base = mean caption-token residual of the # NEGATIVE-label validation images (NEG_JSONL[BASELINE_SPLIT], capped BASELINE_NUM, # forwarded with the same FORCED_TEXT). Direction normalized to unit; step is # ALPHA*‖h_l‖*ĝ (ALPHA a fraction of the residual norm) — plus a 'full' panel # h'=h+(x−b). Δ toilet score read at every layer l'>=l. Averaged → heatmap. # # Tunables (override inline, e.g. NUM_IMAGES=128 IG_STEPS=64 bash