What does Andrej Karpathy recommend as the default activation function?

Andrej Karpathy recommends ReLU as the default activation function. In his telling, sigmoid was historically common, but after 2012 ReLU became popular because it makes networks converge faster. He frames other functions like leaky ReLU, maxout, and ELU as active research alternatives rather than the default choice.

“Historically, people use sigmoid @nh. As of 2012, ReLU became quite popular. It makes your networks converge quite a bit faster. So right now, if you wanted a default choice for a non-linearity, use ReLU. That's the current default recommendation. And then there's a few kind of hipster activation functions here, and so leaky relatives were proposed a few years ago, max-out is interesting, very recently ELU, and so you can come up with different activation functions, and you can describe why these might work better or not. And so this is an active area of research, trying to come up with these activation functions that perform or had better properties in one way or another.”
— Andrej Karpathy, CS231n Winter 2016 Lecture 4 · at 1:07:24
Andrej Karpathy: Andrej Karpathy on Backpropagation: Computational Graphs and Gradients

Key takeaways

  • Use ReLU as a strong default when starting a neural net.
  • Activation functions affect convergence speed.
  • Alternative activations are worth exploring, but ReLU is the baseline.

Context

Karpathy is discussing historical choices of nonlinearities while teaching introductory neural networks in CS231n. The quote above is taken word for word from the recording's transcript.

In the transcript

…works like your brain. But okay, I'm not going to go too deep into this. To go back to a question that was asked before, there's an entire set of nonlinearities that we can choose from. So historically, sigmoid has been used quite a bit, and we're going to go into much more detail over what these nonlinearities are, what are their trade-offs, and why you might want to use

Historically, people use sigmoid @nh. As of 2012, ReLU became quite popular. It makes your networks converge quite a bit faster. So right now, if you wanted a default choice for a non-linearity, use ReLU. That's the current default recommendation. And then there's a few kind of hipster activation functions here, and so leaky relatives were proposed a few years ago, max-out is interesting, very recently ELU, and so you can come up with different activation functions, and you can describe why these might work better or not. And so this is an active area of research, trying to come up with these activation functions that perform or had better properties in one way or another.

Much more detail soon in the class, but for now we have these neurons, we have a choice of activation function, and then we rank these neurons into neural networks, right? So we just connect them together so they can talk to each other. And so here's an example of a what two-layer neural, or three-layer and all that. When you want to count the number of layers in a…

Read the full transcript of CS231n Winter 2016 Lecture 4

Topics

What others said about neural networks

More questions about Andrej Karpathy

All Andrej Karpathy answers · All Andrej Karpathy recordings

How this answer was made: the quote is checked word for word against the transcript of the recording and confirmed as the speaker's own words; the summary above it was drafted with AI from that transcript and quality-checked. Methodology and corrections.

Search every transcript
Open the full search page →