RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Eruo Fredoline
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
Glossary / Transformer & LLM components / SwiGLU
Transformer & LLM components

SwiGLU

SwiGLU is a gated feed-forward activation: (W1·x ⊙ swish(W2·x)) · W3, replacing the standard MLP's GELU/ReLU in modern transformers. Used in PaLM, Llama, Mistral, Qwen, DeepSeek.

The gating gives a small but consistent perplexity improvement vs GELU MLP at the same parameter budget. The cost is one extra weight matrix (W2), making SwiGLU FFN blocks ~50% larger in parameter count than GELU MLP — which is why Llama-style architectures size the FFN dimension at ~2.67× hidden instead of the classic 4×.

For inference, SwiGLU adds one more matmul per layer; modern attention/FFN fused kernels handle it natively.

Practical example

When estimating VRAM for a custom fine-tune, an operator sizing a Llama 3.1 8B model needs to account for the SwiGLU FFN's extra weight matrix — the feed-forward blocks alone (with three matrices instead of two) make up a larger share of total parameters than they would in a GPT-2-style GELU MLP at the same hidden size. This matters when someone tries to shrink a model by naively halving the FFN dimension to save memory: because SwiGLU already runs a narrower ~2.67× multiplier instead of 4×, further squeezing it costs more relative capacity than it would in a classic architecture. Practically, if you're writing a custom inference kernel or a from-scratch quantizer rather than using llama.cpp or vLLM, budget for three GEMMs per FFN layer, not two, when profiling matmul time.'

Related terms

RMSNormTransformer

Reviewed by Eruo Fredoline. See our editorial policy.

Buyer guides
  • Best GPU for local AI →
  • Best laptop for local AI →
  • Best Mac for local AI →
When it doesn't work
  • CUDA out of memory →
  • Ollama running slowly →
  • ROCm not detected →