Papers
Topics
Authors
Recent
Search
2000 character limit reached

HyperGLU Block Design

Updated 16 February 2026
  • HyperGLU is a neural network block that reformulates autoregressive self-attention as a dynamic two-layer MLP with context-dependent parameters.
  • It replaces softmax normalization with gated linear units and employs diagonal-plus-low-rank mixing for flexible, efficient feature and sequence routing.
  • The design uses reverse-offset layouts to enforce autoregressive consistency while matching or outperforming traditional attention within fixed parameter budgets.

HyperGLU is a neural network block introduced within the HyperMLP framework, which reconceptualizes autoregressive self-attention as a dynamic two-layer multi-layer perceptron (MLP) whose parameters are instantiated from context history. HyperGLU replaces softmax-normalized attention with a gated linear unit (GLU) structure that decouples routing and weighting across a dynamically constructed memory pool, providing greater representational flexibility and dynamically learned mixing in both feature and sequence spaces. The architecture leverages a "reverse-offset" (lag) layout to ensure autoregressive truncation consistency and employs diagonal-plus-low-rank (DPLR) mixing for parameter efficiency and expressivity. This design consistently matches or outperforms classical softmax-attention heads under fixed parameter budgets, with theoretical and empirical advantages in context mixing and boundary structure (Lu et al., 13 Feb 2026).

1. Reformulation of Attention as Dynamic MLP

Traditional self-attention computes a weighted sum of values using softmax-normalized query-key similarities, effectively restricting attention scores to a probability simplex. HyperGLU, following the paradigm proposed by Lu & Yang (2026), interprets an autoregressive (AR) attention head as a depth-two MLP with context-length-dependent width, where the history X1:tX_{1:t} dynamically determines first- and second-layer weight matrices through factorized hypernetwork parameterizations. Rather than probabilities, scores htRth_t\in\mathbb{R}^t are generic pre-activations, allowing for broader forms of input-conditioned selection via nonlinearity.

Unlike softmax attention, which enforces convex combinations, HyperGLU employs GLU gating: ReLU or GLU activations over the slot axis permit selection/routing of tokens independently of normalization, resulting in more flexible and expressive context mixing, including learnable sequence mixing (see Table 1, section 4 below). The activation function design further decouples magnitude modulation from selection, with the gate (ReLU) and scale (Softplus) components acting independently.

2. Mathematical Specification

Let xtR1×dx_t\in\mathbb{R}^{1\times d} denote the input at time tt, and Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d} the lag-ordered prefix (newest first). The HyperGLU block, viewed as a residual update, is:

Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}

HyperGLU factorizes both W(1)W^{(1)} and W(2)W^{(2)} using context-dependent hypernetworks:

W(1)(Xt:1)=L(1)(xt)Xt:1R(1)(xt)Rd×tW^{(1)}(X_{t:1}) = L^{(1)}(x_t)\, X_{t:1}^\top R^{(1)}(x_t) \in \mathbb{R}^{d\times t}

W(2)(Xt:1)=(R(2)(xt))Xt:1L(2)(xt)Rt×dW^{(2)}(X_{t:1}) = (R^{(2)}(x_t))^\top\, X_{t:1} L^{(2)}(x_t) \in \mathbb{R}^{t\times d}

  • htRth_t\in\mathbb{R}^t0
  • htRth_t\in\mathbb{R}^t1
  • htRth_t\in\mathbb{R}^t2 for htRth_t\in\mathbb{R}^t3

The DPLR parameterization for each sequence mixer htRth_t\in\mathbb{R}^t4:

htRth_t\in\mathbb{R}^t5

with low ranks htRth_t\in\mathbb{R}^t6, typically htRth_t\in\mathbb{R}^t7.

The first-layer output htRth_t\in\mathbb{R}^t8 is split into gate and scale branches. Activation proceeds as:

htRth_t\in\mathbb{R}^t9

The xtR1×dx_t\in\mathbb{R}^{1\times d}0 gate controls routing (binary selection), whereas Softplus modulates magnitude per slot.

AR-truncation consistency is enforced by the canonical top-left extension of xtR1×dx_t\in\mathbb{R}^{1\times d}1 in lag-order: adding more distant tokens does not change the output on recent windows, by applying xtR1×dx_t\in\mathbb{R}^{1\times d}2 prefix slicing.

3. Architectural Workflow and Implementation

The overall forward pass for a single HyperGLU head at step xtR1×dx_t\in\mathbb{R}^{1\times d}3 follows:

W(1)W^{(1)}3

No dense xtR1×dx_t\in\mathbb{R}^{1\times d}4 matrices are materialized; all mixing is performed through low-rank contractions and efficient fused kernels.

4. Comparison with Softmax-Attention and GLU-MLP

Aspect Softmax-Attention Standard GLU-MLP HyperGLU
Normalization xtR1×dx_t\in\mathbb{R}^{1\times d}5 (slot axis) None (ReLU+LN on features) xtR1×dx_t\in\mathbb{R}^{1\times d}6 + ReLU/GLU (slot axis)
Routing Probabilistic weights Feature-axis gating Dynamic two-layer slot routing
Parameter Instantiation Fixed xtR1×dx_t\in\mathbb{R}^{1\times d}7 Static weights xtR1×dx_t\in\mathbb{R}^{1\times d}8 (hypernetwork)
Sequence Mixing Identity (xtR1×dx_t\in\mathbb{R}^{1\times d}9) None Learned DPLR in both layers
Expressivity CPWL in tt0, tt1 regions CPWL in features PW-smooth, warped partitions + bases
Budget Allocation tt2 tt3 Same; pays for seq-mix by reducing tt4
Key Benefit Parallel AR & KV cache Efficient feature gating Richer context routing, curved boundaries

HyperGLU generalizes both softmax-attention and standard GLU gating by introducing nonlinear, dynamically-warped gating boundaries and parameter-efficient, learned sequence mixing.

5. Expressivity and Theoretical Properties

5.1 Routing Boundary Structure

With static mixing, token-wise ReLU attention induces polyhedral partitions of the input space, segmenting tt5 by tt6, for tt7. HyperMLP/HyperGLU with dynamic tt8 and tt9 replaces polyhedral regions with piecewise-smooth (Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}0) curved gating hypersurfaces: Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}1, where Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}2. This strictly expands the functional expressivity.

5.2 Decoupled Gating and Scaling

Proposition 2.4 formalizes that, under HyperGLU,

Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}3

with ReLU determining the routed subset and Softplus modulating activation magnitudes independently.

5.3 Budget Considerations

Theorem 2.5 demonstrates that reducing first-layer (routing) rank Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}4 is less detrimental than shrinking the second-layer (action) rank Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}5, since Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}6 defines the update subspace. Thus, HyperGLU can trade QK width for sequence mixing richness, matching or surpassing ReLU-attention expressivity at constant parameter cost.

5.4 Parameter Cost Matching

Given a classical ReLU-attention head cost Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}7, HyperGLU maintains this envelope by choosing Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}8 such that Xt:1=[xt;;x1]Rt×dX_{t:1}=[x_t;\dots;x_1]\in\mathbb{R}^{t\times d}9, allocating the surplus to temporal DPLR sequence mixing.

6. Practical Considerations and Hyperparameters

Recommended settings for typical sequence modeling tasks include:

  • Model width Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}0, number of heads Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}1.
  • Feature ranks Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}2, Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}3 for two heads, preserving Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}4 total parameters.
  • Sequence mixing rank Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}5.
  • Diagonal cores Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}6 with Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}7 learned.
  • Gates use Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}8, stabilization parameter Ot=xt+o(ht)W(2)(Xt:1),ht=xtW(1)(Xt:1)R1×tO_t = x_t + o(h_t) W^{(2)}(X_{t:1}), \qquad h_t = x_t W^{(1)}(X_{t:1}) \in \mathbb{R}^{1\times t}9.
  • Depthwise convolution (kernel size 4) can optionally enhance mixing.
  • Lag-ordered prefix is stored as a single buffer; all DPLR mixing achieved via two low-rank GEMMs plus a fused ‘epilogue’ kernel.
  • Training complexity is dominated by W(1)W^{(1)}0, with additional W(1)W^{(1)}1 for sequence mixing; per-step inference is W(1)W^{(1)}2.

HyperGLU blocks can be efficiently implemented using fused kernels (e.g., Triton), with memory and computation scaling controlled by rank and width hyperparameters, supporting deployment with similar or better efficiency to conventional attention heads (Lu et al., 13 Feb 2026).

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

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 HyperGLU Block Design.