← All questions
LLM FoundationsMedium· Model Architecture· FFN

How do you calculate the FFN dimension for a SwiGLU model with a dmodel of 8192?

To determine the FFN dimension for a SwiGLU model with dmodel=8192, multiply by 8/3 to get 21845.3. Rounding this to a multiple of 128 gives 21888. When finalizing this number, you must ensure that the dimension is divisible by your tensor-parallel degree to maintain efficient computation.

Code playground (Python)