PracHub
QuestionsLearningGuidesInterview Prep

LLMs – Activation Functions (3)

The resource examines feed-forward network (FFN) blocks in Transformer architectures, focusing on activation functions, gated FFN designs, the......

Author: PracHub

Published: 12/21/2025

Home›Knowledge Hub›LLMs – Activation Functions (3)

LLMs – Activation Functions (3)

By PracHub
December 21, 2025
0

Quick Overview

The resource examines feed-forward network (FFN) blocks in Transformer architectures, focusing on activation functions, gated FFN designs, the distinction between attention and FFN roles, and implementation and performance considerations for large language models.

Machine Learning EngineerFree

Feed-Forward Networks (FFN) in Transformers: From Linear Blocks to Gated Designs

image.png

In Transformer models, attention usually gets all the credit. But in practice, the Feed-Forward Network (FFN) block is where most parameters live and where a large portion of a model’s expressive power comes from. If attention decides what information to mix, FFNs decide how to transform it.

LLMs – Activation Functions (3) interview prep framework Technical Interview Prep Framework Use the flow below to turn the article into a concrete practice plan. Frame what matters Practice representative tasks Explain reasoning aloud Review gaps and fixes After each practice rep, write down what broke, then repeat the lane that exposed the gap.

This post is meant to be a learning resource, helping you understand FFN computation formulas, activation choices, and why modern LLMs moved from simple FFNs to gated variants. More importantly, it connects these ideas to broader model design principles you’ll see far beyond Transformers.


  1. What is the computation formula of the FFN block? pasted-image-1766349173873.png

  2. What is the computation formula of GeLU? pasted-image-1766349186650.png

  3. What is the computation formula of Swish? Here’s what matters conceptually: pasted-image-1766349215241.png Uses 2 trainable weight matrices Hidden dimension is 4h

  4. What is the FFN computation formula using GLU (Gated Linear Unit)? pasted-image-1766349234647.png

  5. What is the computation formula of GLU using GeLU? pasted-image-1766349247750.png

  6. What is the computation formula of GLU using Swish? pasted-image-1766349257692.png Note: Uses 3 trainable weight matrices Hidden dimension is 4h×23\frac{4h \times 2}{3}34h×2​

Which activation functions are used by different LLMs? pasted-image-1766349279385.png

  • The FFN uses two trainable weight matrices
  • The hidden dimension is typically 4× the model dimension
  • The same FFN is applied to every token position

pasted-image-1766349295523.png For a model with hidden size (h = 4096), the FFN expands activations to:

[ 4h = 4 \times 4096 = 16384 ]

This expansion is not arbitrary. It gives the model room to learn richer, nonlinear transformations before projecting back down.

This design pattern - expand → nonlinearity → compress - appears everywhere in deep learning, from ResNets to diffusion models.


2. Activation Functions: Why Nonlinearity Matters

Without a nonlinearity, the FFN would collapse into a single linear transformation. Activation functions determine how expressive and trainable the block becomes.

GeLU (Gaussian Error Linear Unit)

GeLU smoothly weights inputs by how likely they are under a Gaussian distribution. Its commonly used approximation is:

[ \text{GeLU}(x) \a

pasted-image-1766346831278.png

How to Use This Page as a Prep Plan

Do not treat this as passive reading. Convert the ideas in this page into a short weekly loop: learn one idea, practice it under interview conditions, then write down what changed. That is the fastest way to turn advice into visible interview behavior.

Prep areaWhat you need to provePractice artifact
UnderstandTurn the prompt into a concrete goal.Clarifying questions and success criteria.
PracticeUse realistic constraints and timed reps.Worked examples with edge cases.
ExplainMake reasoning visible.Tradeoffs, assumptions, and test strategy.
ImproveReview misses quickly.A short feedback log and next action.

For LLMs – Activation Functions (3), the strongest candidates usually do three things well: they make their assumptions explicit, they use concrete examples instead of vague claims, and they review mistakes quickly enough that the next practice rep is better than the last one.

Video Walkthrough

This verified YouTube video gives a second pass on the same preparation area. Use it after reading the guide, then come back and turn the advice into a practice artifact.

FAQ

How should I use this guide?

Read it once for the structure, then turn each section into a practice task with a visible artifact.

What should I do if I am short on time?

Prioritize the skills most likely to be tested, then do one mock or timed drill to expose the largest gap.

How do I know I am ready?

You can explain your approach clearly, recover from hints, and name tradeoffs without relying on memorized wording.


Comments (0)


Related Articles

Machine Learning Interview Questions: Complete 2026 Guide

This guide covers applied machine learning interview topics in 2026, including coding problems, ML theory such as bias–variance and evaluation......

10 minMachine Learning Engineer

Machine Learning Engineering Interview Guide (MLOps & AI 2026)

This guide covers MLOps and ML system design for 2026 interviews, including model deployment and production maintenance, CI/CD for models, data......

1Machine Learning Engineer

Shopify Machine Learning Engineer Interview Guide 2026

This guide details Shopify's 2026 Machine Learning Engineer interview process and study map, covering stages such as recruiter screens, the Life Story......

5 minMachine Learning Engineer

Snapchat Machine Learning Engineer Interview Guide 2026

This guide covers the Snapchat Machine Learning Engineer interview process in 2026, including recruiter and technical screens, virtual onsite loops......

5 minMachine Learning Engineer
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.