Papers
Topics
Authors
Recent
Search
2000 character limit reached

Compact Gated Linear Unit (CGLU)

Updated 5 July 2026
  • 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

σ(wx)=(wx)1{wx0},\sigma(w^\top x) = (w^\top x)\,\mathbf{1}\{w^\top x \ge 0\},

which exposes it as the product of a linear term and a hard gate controlled by the same vector ww. GaLU separates these two roles by assigning different vectors u,vRdu,v \in \mathbb{R}^d: gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}. Under the hard gate, ugu,v(x)=0\nabla_u g_{u,v}(x)=0 almost everywhere, so the gate parameter uu is fixed after random initialization, typically uN(0,Id)u \sim N(0,I_d), and training updates only the linear part vv (Fiat et al., 2019).

For transformer feed-forward networks, a standard GLU is written in the MGLU formulation as

GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),

with separate gate and value matrices. MGLU makes this compact by introducing one shared weight matrix WW and a binary mask ww0: ww1 Here ww2, 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 ww3 None
GaLU ww4 Decoupled gate/value
Single-mask MGLU ww5 Shared matrix + mask

2. GaLU as the theoretical foundation for compact hard-gated units

A one-hidden-layer GaLU network with ww6 hidden units and scalar output is

ww7

Because the model is linear in ww8, one may absorb the output weights into ww9 and rewrite the network as

u,vRdu,v \in \mathbb{R}^d0

where u,vRdu,v \in \mathbb{R}^d1 and

u,vRdu,v \in \mathbb{R}^d2

Training therefore reduces to linear regression on a random feature map with fixed gates (Fiat et al., 2019).

For a sample u,vRdu,v \in \mathbb{R}^d3, the associated block design matrix is

u,vRdu,v \in \mathbb{R}^d4

Optimization becomes the convex problem u,vRdu,v \in \mathbb{R}^d5. The key data-dependent quantity is

u,vRdu,v \in \mathbb{R}^d6

assumed positive. Under this assumption, if

u,vRdu,v \in \mathbb{R}^d7

then with probability at least u,vRdu,v \in \mathbb{R}^d8,

u,vRdu,v \in \mathbb{R}^d9

which implies full row rank and zero training loss by linear regression.

For random Gaussian or spherical data, the bounds sharpen. When gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.0 are i.i.d. on the unit sphere gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.1 and gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.2, there exist absolute constants gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.3 such that

gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.4

implies

gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.5

with the stated high probability. This yields memorization at width gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.6, improving on the cited ReLU theory requiring gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.7 under bounded derivatives (Fiat et al., 2019).

The same rank perspective also characterizes the under-parameterized regime. When labels are i.i.d. gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.8,

gu,v(x)  =  (vx)1{ux0}.g_{u,v}(x) \;=\; (v^\top x)\,\mathbf{1}\{u^\top x \ge 0\}.9

When ugu,v(x)=0\nabla_u g_{u,v}(x)=00, ugu,v(x)=0\nabla_u g_{u,v}(x)=01, so the loss behaves like ugu,v(x)=0\nabla_u g_{u,v}(x)=02. 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 ugu,v(x)=0\nabla_u g_{u,v}(x)=03, training with squared loss has a convex landscape. If ugu,v(x)=0\nabla_u g_{u,v}(x)=04, ugu,v(x)=0\nabla_u g_{u,v}(x)=05, and

ugu,v(x)=0\nabla_u g_{u,v}(x)=06

then after

ugu,v(x)=0\nabla_u g_{u,v}(x)=07

iterations of gradient descent, the squared loss is at most ugu,v(x)=0\nabla_u g_{u,v}(x)=08 with probability at least ugu,v(x)=0\nabla_u g_{u,v}(x)=09. The argument uses convexity together with spectral control of uu0 (Fiat et al., 2019).

The corresponding normalized GaLU network induces the kernel

uu1

The random features uu2 approximate this kernel in expectation. If the data distribution is realizable by some uu3, where uu4, and if

uu5

then with probability at least uu6, the empirical risk minimizer satisfies

uu7

Under the realizability assumption and fixed gates, this gives an uu8 decay rate rather than the uu9 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: uN(0,Id)u \sim N(0,I_d)0 This aligns failure modes such as parity failure across the two models. A further result states that when ReLU training remains within uN(0,Id)u \sim N(0,I_d)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

uN(0,Id)u \sim N(0,I_d)2

where uN(0,Id)u \sim N(0,I_d)3 and uN(0,Id)u \sim N(0,I_d)4 are shared bases, uN(0,Id)u \sim N(0,I_d)5 is a per-neuron linear code, and uN(0,Id)u \sim N(0,I_d)6 is a per-neuron gate code. The associated one-hidden-layer network is

uN(0,Id)u \sim N(0,I_d)7

If uN(0,Id)u \sim N(0,I_d)8 is fixed, training in uN(0,Id)u \sim N(0,I_d)9 remains convex; if vv0 is trained, the problem becomes bi-linear. This compactifies the trainable linear part from vv1 to vv2, with gate storage vv3 if gates are stored (Fiat et al., 2019).

Three concrete compactification mechanisms are described.

First, gate sharing introduces a dictionary vv4 with vv5 and reuses gates across neurons: vv6 This reduces gate storage to vv7. However, duplicating gates does not increase vv8, so memorization still requires sufficiently many distinct gates.

Second, low-rank linear predictors write vv9 with GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),0, GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),1. The effective design matrix becomes GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),2, whose rank is at most GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),3. Exact memorization therefore requires GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),4, equivalently width GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),5.

Third, gate compression writes GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),6 with GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),7, GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),8, and fixed random GLU(x)=g(xWg)(xWv),\mathrm{GLU}(x) = g(x W_g) \odot (x W_v),9. This reduces gate storage but also reduces gate diversity. The synthesis notes that one should choose WW0 so that the induced gate kernel maintains WW1 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 WW2, a compact model with WW3 distinct gates and per-unit linear dimension WW4 should satisfy WW5 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 WW6 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 WW7: WW8 The MGLU construction replaces these with a single shared matrix WW9 and one or more learned binary masks. The single-mask case,

ww00

is the minimal compact GLU. To increase expressiveness, MGLU introduces a Mixture of Element-wise Gating (MoEG) with multiple masks: ww01 Each route ww02 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 ww03 bits per token, whereas MGLU with ww04 masks reads ww05 bits. At ww06, the reduction is

ww07

that is, 47% fewer bits transferred. The paper further notes that MGLU still breaks even with GLU up to ww08 at FP16 inference. For Llama-1B with ww09 and ww10, the FFN up-projection weights per layer shrink from 96 MB to 64 MB, and one 1-bit mask adds approximately 2 MB for ww11 (Tajima et al., 29 Jun 2025).

Parameter counts also change materially. A GLU up-projection has ww12 FP16 parameters. MGLU uses ww13 FP16 weights plus ww14 mask bits at inference; during training, the masks are maintained as FP16 logits, adding ww15 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 ww16 multiply-adds per token, versus ww17 for SwiGLU. Because low-batch decoding is memory-bound, the reduction in FP16 reads dominates latency. During training, however, the reported cost is approximately ww18 per token for SwiMGLU versus ww19 for SwiGLU, so large ww20 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 ww21 in SwiGLU severely hurts perplexity, to 27.0 relative to 23.6 for SwiGLU, whereas masked sharing preserves multiplicative capacity with one shared ww22. 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 ww23 masked matrix-vector products and repeatedly reload ww24, remaining memory-bound. FlashMGLU instead fuses these operations so that each weight is touched once. The reported implementation uses bit-packing of the ww25 mask flags into a single 8-bit integer, single shared loading of ww26 and mask words per tile, complementary masks to recover value sums from an unmasked total ww27 and masked partial sums ww28, Split-K tiling with on-chip accumulation, and fused arithmetic in registers. After reduction, the kernel writes gate sums ww29 and value sums ww30, 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.66ww31 speed-up over a naive PyTorch MGLU at ww32, reducing latency from 0.5210 ms to 0.0265 ms. Relative to standard PyTorch GLU, it is up to 1.51ww33 faster in the ww34 case and remains at least 1.24ww35 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 ww36, and 46.49% with ww37. Validation perplexity improves from 25.0 at ww38 to 23.5 at ww39, 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 ww40, 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 ww41 suffices for both GaLU and ReLU to reach MSE ww42, GaLU loss follows ww43 in the under-parameterized regime, and parity is failed by both models. On linearly separable data in ww44, 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 ww45 to ww46. 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 ww47, 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 ww48 bounded and ww49. In MGLU, mask learning is discrete and depends on the straight-through estimator; training cost rises with ww50, and the strongest kernel optimizations are implemented for CUDA GPUs. The masked models also exhibit diminishing returns beyond ww51 to ww52, so maximum compactness at ww53 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).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Compact Gated Linear Unit (CGLU).