← Questions

Implement a transformer block with SwiGLU

0
GoogleCodingLast asked Dec 2025

Write a transformer block from scratch: multi-head self-attention, the residual connections and normalisation, and a feed-forward layer that uses the SwiGLU gate (two parallel projections, one passed through SiLU, multiplied together, then projected back). Explain the tensor shapes at each step.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding