SwiGLU has three weight matrices instead of two, so to keep the parameter count matched to a standard feed-forward layer, the hidden width is set to about two thirds of four times the model width. The result is rounded up to a hardware-friendly multiple.
Implement llama_hidden_dim(dim, multiple_of), returning int(8 * dim / 3) rounded up to a multiple of multiple_of.
Compute int(2 * 4 * dim / 3), then round up with integer arithmetic.
No results yet
Run your code to check it against the examples, or submit to run every test.