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.”

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…
Topics
What others said about neural networks
More questions about Andrej Karpathy
- Why does Andrej Karpathy say neural networks are arranged in layers?
- What is a neural network, according to Andrej Karpathy?
- What is micrograd and why did Andrej Karpathy build it?
- What initialization loss did Andrej Karpathy expect for a character-level language model?
- How does Andrej Karpathy use learning rate decay in training neural networks?
- What did Andrej Karpathy say about attention and MLPs in Transformers?
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.