Gradient saliency

Attribution · lens

A map of how sensitive one output score is to each input pixel: the gradient of the score with respect to the input, drawn as an image.

Also called Saliency map, Input gradient, Vanilla gradient

For each pixel of the photo: how fast the score of the photo’s own class (Pothos) would change if that pixel changed a little, the largest of its red, green and blue values, averaged over 4 × 4 pixels. Computed with the real plant classifier by backpropagation, once per photo. Bright cells are where the score is most sensitive; each map is scaled to its own 99th percentile.

Photo with the map on top

Pothos

Original head: Pothos

|∂ score / ∂ pixel| · 56 × 56

The archived edit changes the Pothos bias, which adds the same amount whatever the pixels are, so these maps are identical before and after it. Point at the map, or focus it and use the arrow keys.

Figure 1. Every number is computed in your browser.

What it shows

Backpropagation, the same step training uses, can run all the way back to the input. The result says, for every pixel, how fast the chosen score would change if that pixel changed a little. Drawn as a heat map it highlights the pixels the score is most sensitive to. It costs one backward pass, where an occlusion test needs one forward pass per patch.

How to read it

Bright cell
The score changes fast when these pixels change.
Dark cell
Small changes here barely move the score.
Sign (when shown)
Whether brightening or adding ink there raises or lowers the score. Many maps show only the size.
Chosen class
Each class has its own map: the gradient of that class’s score.

What it does not tell you

A gradient is local: it describes tiny changes around this exact input, not what happens when a region is removed, which is why it can disagree with occlusion. Raw gradients are noisy and can look sharp even for a model that has learned little; methods such as SmoothGrad and integrated gradients exist to correct for this. A bias edit adds the same amount to a score whatever the input, so it leaves the map unchanged. Not to be confused with the Salient objects model in the catalog, whose output is also called a saliency map: that is a model’s answer, not a look inside one.

A quick first look at what an image or text classifier is sensitive to, debugging inputs (a map lit on a watermark or border), and teaching how backpropagation works.

In WeightSpace

The figure’s first tab shows real gradients of the plant classifier, computed from the shipped checkpoint with the same input scaling as the app, for three sample photos. The second tab gives exact gradients of the tiny stroke network next to its occlusion map, so you can draw and watch the two disagree. No workbench draws gradients yet.

Where to see it

No workbench draws this yet: the figure at the top of this page is the only place in WeightSpace for now.

Model structures: Identify houseplants