What is the significance of the 'ReLU' activation function in deep learning?

Instruction: Define ReLU, calculate its outputs for inputs -2, 0 and 3, and explain its gradient advantages and limitations in a deep network.

Context: This question probes the candidate's understanding of one of the most commonly used activation functions in neural networks and its impact on model performance.

Updated

Worked answer

ReLU is f(x)=max(0,x), so the outputs for [-2,0,3] are [0,0,3]. It adds nonlinearity with a simple elementwise operation; without nonlinearities, a sequence of ordinary affine layers would still represent an affine transformation.

For positive inputs its derivative is 1; for negative inputs it is 0. At zero the mathematical function is not differentiable, so an implementation needs a chosen convention. The positive branch avoids the saturation of sigmoid or tanh at large positive input, which can help gradient propagation. The chain through weights and other layers can still shrink or amplify gradients.

A unit that remains negative across its training inputs receives zero local gradient through ReLU for those inputs. This can impair learning, but one negative activation does not establish that the unit is permanently inactive. Inspect activation distributions, parameter updates and gradients alongside initialization, learning rate and normalization.

Leaky ReLU typically uses a fixed nonzero negative slope; PReLU learns that slope, which need not remain nonzero. Both have design and evaluation choices. They do not guarantee better accuracy or convergence on every task. Compare under the same training and evaluation setup instead of attributing an invented project improvement to the activation alone.

Source: PyTorch ReLU definition.

Related Questions