Compact Gated Linear Unit (CGLU)
- Compact Gated Linear Unit (CGLU) is defined by decoupling multiplicative gating from linear prediction, achieving parameter efficiency through fixed gates or mask-based sharing.
- It reduces parameter counts and memory traffic by sharing weights or compressing gate representations, enabling cost-effective training and faster inference.
- The CGLU framework, encompassing GaLU and MGLU variants, offers convex optimization benefits and empirical performance improvements in large language model architectures.
Searching arXiv for the cited papers to ground the article in current records. arXiv search: "Decoupling Gating from Linearity" and "Masked Gated Linear Unit" Compact Gated Linear Unit (CGLU) is an Editor’s term for compact parameterizations of gated linear units that preserve multiplicative gating while reducing parameter count, storage, or memory traffic. Two distinct but related research lines motivate the term. In the first, the Gated Linear Unit (GaLU) decouples the gating vector from the linear predictor, fixes the gate after random initialization, and thereby converts one-hidden-layer training into convex linear regression on a random feature map (Fiat et al., 2019). In the second, the Masked Gated Linear Unit (MGLU) replaces the two projection matrices of a standard GLU with one shared matrix plus complementary binary masks, yielding a compact GLU implementation for LLM feed-forward networks (Tajima et al., 29 Jun 2025). Taken together, these lines define CGLU as a family of architectures in which gating and value computation remain multiplicative, but compactness is achieved either by decoupling-and-sharing in function space or by mask-based sharing in parameter space.
1. Conceptual definition and formal forms
A standard ReLU neuron can be written as
which exposes it as the product of a linear term and a hard gate controlled by the same vector . GaLU separates these two roles by assigning different vectors : Under the hard gate, almost everywhere, so the gate parameter is fixed after random initialization, typically , and training updates only the linear part (Fiat et al., 2019).
For transformer feed-forward networks, a standard GLU is written in the MGLU formulation as
with separate gate and value matrices. MGLU makes this compact by introducing one shared weight matrix and a binary mask 0: 1 Here 2, so the shared matrix is partitioned into complementary gate and value subspaces. The source paper does not use the term CGLU, but this single-mask construction is explicitly identified as a compact GLU instantiation (Tajima et al., 29 Jun 2025).
A useful synthesis is that CGLU preserves the defining GLU operation—elementwise multiplication of a gate stream and a value stream—while compactness is induced by one of two mechanisms: fixed random gates plus reduced trainable structure, or shared weights plus learned binary partitions.
| Variant | Core form | Compactness mechanism |
|---|---|---|
| ReLU | 3 | None |
| GaLU | 4 | Decoupled gate/value |
| Single-mask MGLU | 5 | Shared matrix + mask |
2. GaLU as the theoretical foundation for compact hard-gated units
A one-hidden-layer GaLU network with 6 hidden units and scalar output is
7
Because the model is linear in 8, one may absorb the output weights into 9 and rewrite the network as
0
where 1 and
2
Training therefore reduces to linear regression on a random feature map with fixed gates (Fiat et al., 2019).
For a sample 3, the associated block design matrix is
4
Optimization becomes the convex problem 5. The key data-dependent quantity is
6
assumed positive. Under this assumption, if
7
then with probability at least 8,
9
which implies full row rank and zero training loss by linear regression.
For random Gaussian or spherical data, the bounds sharpen. When 0 are i.i.d. on the unit sphere 1 and 2, there exist absolute constants 3 such that
4
implies
5
with the stated high probability. This yields memorization at width 6, improving on the cited ReLU theory requiring 7 under bounded derivatives (Fiat et al., 2019).
The same rank perspective also characterizes the under-parameterized regime. When labels are i.i.d. 8,
9
When 0, 1, so the loss behaves like 2. This makes explicit that the effective capacity is governed by the rank of the gated design matrix rather than by nominal width alone.
3. Optimization, kernel structure, and relation to ReLU
Because the GaLU reparameterization is linear in 3, training with squared loss has a convex landscape. If 4, 5, and
6
then after
7
iterations of gradient descent, the squared loss is at most 8 with probability at least 9. The argument uses convexity together with spectral control of 0 (Fiat et al., 2019).
The corresponding normalized GaLU network induces the kernel
1
The random features 2 approximate this kernel in expectation. If the data distribution is realizable by some 3, where 4, and if
5
then with probability at least 6, the empirical risk minimizer satisfies
7
Under the realizability assumption and fixed gates, this gives an 8 decay rate rather than the 9 rate emphasized in the comparison to cited ReLU analyses (Fiat et al., 2019).
The relation to ReLU is subtle. At initialization, under hinge loss and bounded outputs, small gradient at initialization occurs with the same probability for GaLU and ReLU: 0 This aligns failure modes such as parity failure across the two models. A further result states that when ReLU training remains within 1 of initialization—the “lazy training” regime—the fixed-gate GaLU is competitive with the trained ReLU. A plausible implication is that decoupled hard-gated models can capture a meaningful subset of ReLU behavior precisely when ReLU learning is dominated by a nearly fixed gating pattern.
4. Compact GaLU: proposed constructions and design rules
Within the GaLU line, a Compact GaLU (CGLU) is proposed by imposing parameter sharing or low-rank structure while keeping decoupled gating and linear prediction. One formal proposal is
2
where 3 and 4 are shared bases, 5 is a per-neuron linear code, and 6 is a per-neuron gate code. The associated one-hidden-layer network is
7
If 8 is fixed, training in 9 remains convex; if 0 is trained, the problem becomes bi-linear. This compactifies the trainable linear part from 1 to 2, with gate storage 3 if gates are stored (Fiat et al., 2019).
Three concrete compactification mechanisms are described.
First, gate sharing introduces a dictionary 4 with 5 and reuses gates across neurons: 6 This reduces gate storage to 7. However, duplicating gates does not increase 8, so memorization still requires sufficiently many distinct gates.
Second, low-rank linear predictors write 9 with 0, 1. The effective design matrix becomes 2, whose rank is at most 3. Exact memorization therefore requires 4, equivalently width 5.
Third, gate compression writes 6 with 7, 8, and fixed random 9. This reduces gate storage but also reduces gate diversity. The synthesis notes that one should choose 0 so that the induced gate kernel maintains 1 bounded, for example by using a near-isometry on the data manifold.
These constructions lead to a compact design rule: because the achievable training loss depends on 2, a compact model with 3 distinct gates and per-unit linear dimension 4 should satisfy 5 to retain zero-loss memorization capacity. This is an inference from the rank analysis rather than a theorem stated in the original 2019 paper, but it follows directly from the stated bound 6 and the exact-loss characterization.
5. Masked compact GLUs in transformer feed-forward networks
In the transformer setting, compactness is framed differently. A standard GLU up-projection uses two FP16 matrices 7: 8 The MGLU construction replaces these with a single shared matrix 9 and one or more learned binary masks. The single-mask case,
00
is the minimal compact GLU. To increase expressiveness, MGLU introduces a Mixture of Element-wise Gating (MoEG) with multiple masks: 01 Each route 02 induces a different gate/value partition while still using one shared FP16 matrix (Tajima et al., 29 Jun 2025).
The compactness advantage is explicit in the memory accounting. For the up-projection at inference, a standard GLU reads 03 bits per token, whereas MGLU with 04 masks reads 05 bits. At 06, the reduction is
07
that is, 47% fewer bits transferred. The paper further notes that MGLU still breaks even with GLU up to 08 at FP16 inference. For Llama-1B with 09 and 10, the FFN up-projection weights per layer shrink from 96 MB to 64 MB, and one 1-bit mask adds approximately 2 MB for 11 (Tajima et al., 29 Jun 2025).
Parameter counts also change materially. A GLU up-projection has 12 FP16 parameters. MGLU uses 13 FP16 weights plus 14 mask bits at inference; during training, the masks are maintained as FP16 logits, adding 15 trainable FP16 parameters. Mask learning is performed through the straight-through estimator: the mask is thresholded to binary in the forward pass, while the backward pass treats the binarization as identity.
The compute trade-off is asymmetric between inference and training. For next-token inference, SwiMGLU incurs 16 multiply-adds per token, versus 17 for SwiGLU. Because low-batch decoding is memory-bound, the reduction in FP16 reads dominates latency. During training, however, the reported cost is approximately 18 per token for SwiMGLU versus 19 for SwiGLU, so large 20 can increase compute cost even as weight storage is reduced.
A central misconception is that compact GLU is equivalent to naive weight tying. The MGLU study explicitly reports that setting 21 in SwiGLU severely hurts perplexity, to 27.0 relative to 23.6 for SwiGLU, whereas masked sharing preserves multiplicative capacity with one shared 22. Compactness therefore comes not from simple equality constraints, but from structured partitioning of a shared weight tensor.
6. Kernel implementation, empirical behavior, and limitations
The efficiency of masked compact GLUs depends on kernel design. A naive MGLU implementation would launch 23 masked matrix-vector products and repeatedly reload 24, remaining memory-bound. FlashMGLU instead fuses these operations so that each weight is touched once. The reported implementation uses bit-packing of the 25 mask flags into a single 8-bit integer, single shared loading of 26 and mask words per tile, complementary masks to recover value sums from an unmasked total 27 and masked partial sums 28, Split-K tiling with on-chip accumulation, and fused arithmetic in registers. After reduction, the kernel writes gate sums 29 and value sums 30, after which the activation and elementwise multiplication are applied route-wise (Tajima et al., 29 Jun 2025).
On an RTX 5090 GPU in FP16, FlashMGLU achieves up to a 19.6631 speed-up over a naive PyTorch MGLU at 32, reducing latency from 0.5210 ms to 0.0265 ms. Relative to standard PyTorch GLU, it is up to 1.5133 faster in the 34 case and remains at least 1.2435 faster for larger shapes. The abstract summarizes the result as 47% more memory-efficient and 34% faster than standard GLUs on an RTX5090 GPU. With four masks and Swish, the paper also reports a 29.1% reduction in projection-layer compute and 37.5% lower memory usage during inference, while matching or surpassing SwiGLU accuracy.
Model-level evaluations use Llama-style decoder-only architectures on FineWeb-Edu, with zero-shot and two-shot accuracy on ARC-E, ARC-C, HellaSwag, PiQA, SciQ, and Winogrande, together with validation perplexity. At the small scale, SwiGLU has 141M weights, whereas SwiMGLU has 113M weights plus mask bits; zero-shot averages are 46.20% for SwiGLU, 46.48% for SwiMGLU with 36, and 46.49% with 37. Validation perplexity improves from 25.0 at 38 to 23.5 at 39, close to SwiGLU’s 23.7. At the large scale, the baseline SwiGLU has 1.08B weights and SwiMGLU has 808M weights plus mask bits; zero-shot average improves from 56.00% to 56.85% at 40, and two-shot average improves from 57.36% to 57.87% (Tajima et al., 29 Jun 2025).
The empirical picture across the two source lines is internally consistent but not identical. In the GaLU experiments, minimal width 41 suffices for both GaLU and ReLU to reach MSE 42, GaLU loss follows 43 in the under-parameterized regime, and parity is failed by both models. On linearly separable data in 44, on MNIST, and on Fashion-MNIST, both GaLU and ReLU perform well, with ReLU slightly better. In the MGLU experiments, compact masked sharing is competitive or superior to dense SwiGLU, especially for 45 to 46. This suggests that “compactness” is not a single phenomenon: in hard-gated shallow models it refers to reduced trainable dimensionality under fixed random gates, whereas in LLM feed-forward blocks it refers to reduced memory traffic through shared weights and learned mask partitions.
Several limitations recur. The GaLU theory is restricted to one-hidden-layer networks with scalar outputs, hard binary gates 47, fixed Gaussian-initialized gates, and realizability assumptions for the RKHS result. Deeper GaLU networks, vector-valued outputs, and soft gates are not analyzed, and soft gates would break the hard-gate convex reduction. In compact GaLU variants, sharing or compressing gates can reduce diversity, so one must preserve enough distinct halfspaces to keep 48 bounded and 49. In MGLU, mask learning is discrete and depends on the straight-through estimator; training cost rises with 50, and the strongest kernel optimizations are implemented for CUDA GPUs. The masked models also exhibit diminishing returns beyond 51 to 52, so maximum compactness at 53 and maximum accuracy need not coincide.
In sum, CGLU denotes a compact gating principle rather than a single canonical architecture. In the GaLU formulation, compactness arises from decoupling gating from linearity and imposing shared or low-rank structure on the trainable linear component, producing convex optimization, rank-based memorization guarantees, and kernel-style generalization (Fiat et al., 2019). In the MGLU formulation, compactness arises from collapsing the two GLU matrices into one shared matrix plus complementary masks, producing substantial memory-bandwidth savings and hardware-efficient inference without sacrificing downstream accuracy (Tajima et al., 29 Jun 2025).