Telnyx - Global Communications Platform ProviderHome
Voice AI AgentsText-to-SpeechSpeech-to-TextEmbeddingsSearch APIBrowser APIMeetingBotVoice DesignInference APIAgentSDKFunctionsStateful ActorsKVSQLDBStorageGlobal NumbersVoice APISIP TrunkingSMS APIEmail APIRCSWhatsAppWebRTCVerify APINumber ReputationNumber LookupDeepfake DetectionBranded CallingIoT SIMeSIMMobile VoicePrivate Wireless GatewaysVirtual Cross ConnectsCloud VPNGlobal IP200+ open-source buildsagent-signup.mdx402View all primitivesHealthcareFinanceTravel and HospitalityLogistics and TransportationContact CenterInsuranceRetail and E-CommerceSales and MarketingServices and DiningView all solutionsVoice AIVoice APIInferenceMobile VoiceSpeech-to-TextText-to-SpeechSIP TrunkingSMS APIEmail APIWhatsApp Business APIGlobal NumbersIoT SIM CardView all pricingOur NetworkGlobal communicationsEdge ComputeAgents PlatformPartnersCareersCustomer storiesResource centerMission Control PortalEventsSupport centerSETIDev DocsIntegrationsCode examples
Contact usLog in
Contact usLog inSign up

Social

Company

  • Our Network
  • Global Coverage
  • Release Notes
  • Careers
  • Voice AI
  • AI Glossary
  • Shop

Legal

  • Data and Privacy
  • Report Abuse
  • Privacy Policy
  • Cookie Policy
  • Law Enforcement
  • Acceptable Use
  • Trust Center
  • Country Specific Requirements
  • Website Terms and Conditions
  • Terms and Conditions of Service

Compare

  • ElevenLabs
  • Vapi
  • Baseten
  • Together.ai
  • Twilio
  • Bandwidth
  • Vonage
  • Amazon Connect
  • Cloudflare
© Telnyx LLC 2026
ISO • PCI • HIPAA • GDPR • SOC2 Type II
Back to Glossary

What Is the ReLU Activation Function? ReLU vs Sigmoid and GELU

ReLU is the most-used activation function: f(x) = max(0, x). Learn how it works, why it beats sigmoid, the dying ReLU problem, and how it compares to GELU and SiLU.

Emily Bowen
Editor: Emily Bowen

Updated August 2026

The rectified linear unit is the most widely used activation function in deep learning, and it is almost embarrassingly simple. If the input is positive, pass it through unchanged. If it is negative, output zero. That one rule, max(0, x), replaced the smooth sigmoid and tanh functions that came before it and made training deep networks practical. The simplicity is the point, not a compromise.

Quick answer: The rectified linear unit (ReLU) is an activation function defined as f(x) = max(0, x): it outputs the input when positive and zero otherwise. Applied after each layer, it gives a network the non-linearity it needs to learn complex patterns. Because it does not saturate for positive inputs, it also avoids the vanishing gradients that slowed the older sigmoid and tanh functions. It is the default activation in most modern neural networks.

What is the ReLU activation function?

The ReLU activation function is a rule applied to the output of a neuron that keeps positive values and zeroes out negative ones. Written as f(x) = max(0, x), its graph is a flat line at zero for negative inputs and a straight 45-degree line for positive ones, with a sharp bend at the origin.

That bend is what matters. A network built only from linear layers can represent only linear relationships, no matter how many layers it stacks. Inserting a non-linear function like ReLU between the layers breaks that limit and lets the network model curves and interactions. Nair and Hinton popularized ReLU in 2010, and within a few years it had become the standard choice for hidden layers.

The ReLU activation function graphed: a flat line at zero for all negative inputs and a straight 45-degree line for positive inputs, meeting at a sharp bend at the origin, showing f of x equals the maximum of 0 and x.

Why is ReLU so widely used?

ReLU is so widely used because it trains deep networks faster and more reliably than the activations it replaced. Three properties explain the popularity:

  • No saturation for positive inputs. Sigmoid and tanh flatten out at their extremes, so their gradients shrink toward zero and early layers barely learn, the vanishing gradient problem. ReLU's positive side has a constant gradient of 1, so the signal passes back through backpropagation undiminished.
  • Cheap to compute. ReLU is a single comparison, with no exponentials to evaluate, so it is faster than sigmoid or tanh on every forward and backward pass.
  • Sparse activation. Because it zeroes every negative input, a ReLU layer leaves many neurons at exactly zero, which makes the network's forward pass more efficient and can act as a mild form of regularization.

Together these make ReLU the default for the hidden layers of convolutional networks, and a common choice across most architectures that are not transformers.

ReLU vs sigmoid, GELU, and other activation functions

ReLU is one of a family of activation functions, and choosing between them is a common decision. The table compares the most common options:

FunctionFormulaRangeKey trait
ReLUmax(0, x)0 to ∞Simple, fast, can "die" on negatives
Sigmoid1 / (1 + e^-x)0 to 1Saturates, used for binary outputs
Tanhtanh(x)-1 to 1Zero-centered but still saturates
Leaky ReLUmax(0.01x, x)-∞ to ∞ReLU with a small negative slope
GELUx · Φ(x)≈ -0.17 to ∞Smooth, weights inputs by a Gaussian
SiLU (Swish)x · σ(x)≈ -0.28 to ∞Smooth, non-monotonic, sigmoid-gated

The practical read: ReLU beats sigmoid and tanh in hidden layers, because both saturate and slow deep training. Sigmoid still earns a place at the output of a binary classifier, where its 0-to-1 range reads as a probability. The smooth activations, GELU and SiLU, often edge out ReLU in the largest models. ReLU stays the simple, fast default whenever a smooth curve is not worth the extra cost.

What are GELU and SiLU?

GELU and SiLU are smooth activation functions that behave like ReLU for large inputs but curve gently through the origin instead of bending sharply. Each multiplies the input by a gate between 0 and 1, so small negative inputs are shrunk rather than zeroed, and each is differentiable everywhere. That smoothness is why they have largely replaced plain ReLU inside large transformers.

GELU, the Gaussian error linear unit, is f(x) = x · Φ(x), where Φ is the cumulative distribution function of the standard normal. It weights each input by the probability that a random Gaussian value falls below it, so more-positive inputs are kept more fully. Hendrycks and Gimpel introduced it in 2016 and reported gains over ReLU across vision, language, and speech tasks. It is now the default activation in most large language models.

SiLU, the sigmoid linear unit (also called Swish), is f(x) = x · σ(x), the input times its own sigmoid. It is non-monotonic: for small negative inputs its output dips slightly below zero before climbing back, a bump that helps gradients flow. It came out of a 2017 search for better activation functions, where swapping ReLU for SiLU raised ImageNet top-1 accuracy by up to about 0.9% on the image classifiers tested.

The trade-off against ReLU is cost. GELU and SiLU both evaluate an exponential, so each is slower per pass, and the accuracy gain is usually small on ordinary networks. In a model with billions of parameters that gain is worth paying for. In a standard convolutional network it usually is not.

Activation functions compared on one axis: ReLU as a hinge at zero, sigmoid and tanh as flattening S-curves, leaky ReLU with a slight negative slope, and the smooth GELU and SiLU curves that dip slightly below zero before rising.

What is the dying ReLU problem?

The dying ReLU problem is when a neuron gets stuck outputting zero for every input and stops learning. It happens because ReLU's gradient is zero for any negative input. If a neuron's weights push it into the negative range for all the training data, no gradient flows back to it, so its weights never update and the neuron is effectively dead.

The usual fixes replace the flat negative side with a small slope. Leaky ReLU outputs 0.01x for negatives instead of zero, so a small gradient always flows and the neuron can recover. The exponential linear unit (ELU) and the smooth GELU and SiLU do the same thing in different ways. When a large fraction of a network's neurons die, switching to one of these variants, or lowering the learning rate, usually brings the network back.

Frequently asked questions

What is the derivative of ReLU?

The derivative of ReLU is 1 for positive inputs and 0 for negative inputs. At exactly zero it is technically undefined, since the function has a sharp corner there, but frameworks simply use 0 (or sometimes 1) at that single point. This simple derivative, either fully on or fully off, is part of why ReLU is cheap to train.

Why use ReLU instead of sigmoid?

ReLU is used instead of sigmoid in hidden layers because sigmoid saturates: its output flattens near 0 and 1, so its gradient vanishes and deep networks train slowly. ReLU keeps a constant gradient of 1 on its positive side, so it does not choke the signal, and it is cheaper to compute. Sigmoid is still useful at the output layer for probabilities.

Is GELU better than ReLU?

GELU often performs slightly better than ReLU in large transformer models, which is why it is the standard activation there, but it is not universally better. GELU stays smooth and keeps a small gradient for negative inputs, so it sidesteps the dying ReLU problem. ReLU is cheaper to compute, because it avoids the Gaussian, and on smaller networks the accuracy gap is usually too small to justify GELU's extra cost.

When should you use Leaky ReLU instead of ReLU?

Use Leaky ReLU when a network suffers from the dying ReLU problem, meaning many neurons output zero and stop learning. Leaky ReLU's small negative slope keeps a gradient alive for those neurons so they can recover. If plain ReLU trains well, there is usually no need to switch, since the difference on healthy networks is small.

Sources

  • Nair and Hinton. Rectified Linear Units Improve Restricted Boltzmann Machines, 2010.
  • Hendrycks and Gimpel. Gaussian Error Linear Units (GELUs), 2016.
  • Ramachandran, Zoph, and Le. Searching for Activation Functions, 2017.
  • Stanford CS231n. Neural Networks notes.
  • PyTorch. torch.nn.ReLU documentation.
Share on Social

Jump to:

What is the ReLU activation function?Why is ReLU so widely used?ReLU vs sigmoid, GELU, and other activation functionsWhat are GELU and SiLU?What is the dying ReLU problem?Frequently asked questionsSources

Sign up for emails of our latest articles and news

This content was generated with the assistance of AI. Our AI prompt chain workflow is carefully grounded and preferences .gov and .edu citations when available. All content is reviewed by a Telnyx employee to ensure accuracy, relevance, and a high standard of quality.

Sign up and start building.

Sign UpContact Us

Ask AI

  • GPT
  • Claude
  • Perplexity
  • Gemini
  • Grok