Swish, also called SiLU, is a smooth neural-network activation function. It multiplies an input by that input’s sigmoid: x × sigmoid(x). Think of it as a flexible volume knob: positive signals pass through almost unchanged, while negative signals are softened instead of abruptly erased. section 12.17
Swish is useful because it:
- Acts nearly linearly for positive inputs, similarly to ReLU. section 12.17
- Keeps a smooth, slightly negative response rather than forcing every negative input to zero. section 12.17
- Can support better gradient flow and help prevent the “dying ReLU” problem. section 12.17
A small implementation
Define sigmoid(x) as 1 / (1 + exp(-x)), then return x * sigmoid(x). In a feed-forward network, apply this operation to each hidden-layer value. The same pattern appears in a two-layer network that transforms a text embedding into a specialized guidance vector for image generation. section 12.11
Figure 12.32 ReLU vs SiLU activation functions
Compare ReLU’s hard cutoff with SiLU’s smooth curve, then inspect the corresponding per-value calculations. section 12.17

