Back to paper library
Paper notesarXiv 2024CVPR 2024

StarNet

An Asterisk

Original paper

Rewrite the Stars

Paper authors

Xu Ma · Xiyang Dai · Yue Bai · Yizhou Wang · Yun Fu

Publication
CVPR 2024Conference
First submitted to arXiv
arXiv:2403.19967
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{lightweightstarnet2024,
  title = {{Rewrite the Stars}},
  author = {Xu Ma and Xiyang Dai and Yue Bai and Yizhou Wang and Yun Fu},
  year = {2024},
  eprint = {2403.19967},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.19967}
}
On this page

An elementwise multiplication is often tucked inside the new architectures of recent years.

Replace a Transformer's FFN with a GLU and two branches multiply. Mamba has a gating branch. In vision, FocalNet, HorNet, and VAN multiply too. The multiplication symbol * looks like a star, so this paper calls it the “star operation.”

Each paper finds multiplication useful but offers a different explanation. FocalNet describes modulation or gating, HorNet points to higher-order features, and VAN calls it convolutional attention. This paper, from Northeastern University and Microsoft, tries to make the mechanism clear. What do two multiplied linear branches add?

Defining the Problem

How Much Separates Addition and Multiplication?

The authors start with a simple block. Input passes through LayerNorm and depthwise convolution, then splits into two fully connected branches, one with GELU. The branches combine by addition or multiplication, followed by a fully connected layer and a residual connection.

Figure 1 from the paper: on the left, a demonstration block runs from Layer Norm to DW-Conv, then splits into two FC branches, with GELU on the left branch. They merge at a red question mark labeled sum or star, then pass through an FC layer and residual addition. The bar chart on the right plots network width from 96 to 448 horizontally, with light-blue sum and light-orange star ImageNet top-1 bars. A dashed red line with triangles marks the gap, decreasing from about 6.5 percentage points at width 96 to about 2.5 at 448.
Figure 1 from Ma et al., taken from PDF page 1. The original caption is omitted.

Stack 12 such blocks to make DemoNet. Change only how the branches combine and compare on ImageNet:

Table: from the paper's Table 2, at fixed depth 12.
Network widthAdditionMultiplication
9651.1%57.6%
12858.5%64.0%
16062.7%68.2%
19266.2%71.7%
22469.6%73.9%
25671.4%75.3%
28872.5%76.1%

Multiplication wins at every width, with a larger gain in narrower networks: 6.5 percentage points at width 96, falling to 3.6 at 288. The authors also fix width and vary depth; the gap stays between 4 and 6.5 points rather than shrinking with depth.

Multiplication is particularly useful in narrow networks. That observation will matter later.

Solving the Problem

Expand the Product

First consider one output channel. Input xx has dd channels, with a 1 appended so the bias can be folded into the weights. Multiplying the two branches gives

(w1⊤x)(w2⊤x)=(∑i=1d+1w1ixi)(∑j=1d+1w2jxj)=∑i=1d+1∑j=1d+1w1iw2j xixj.(w_1^\top x)(w_2^\top x)=\Big(\sum_{i=1}^{d+1} w_1^i x_i\Big)\Big(\sum_{j=1}^{d+1} w_2^j x_j\Big)=\sum_{i=1}^{d+1}\sum_{j=1}^{d+1} w_1^i w_2^j\, x_i x_j .

The expansion is a linear combination of all xixjx_i x_j terms. Since xixjx_i x_j and xjxix_j x_i are identical, merging them leaves (d+2)(d+1)/2(d+2)(d+1)/2 terms, roughly d2/2d^2/2. Computation takes place in dd dimensions, yet the result acts like a linear operation in a space of roughly d2/2d^2/2 dimensions, each a quadratic term of the input.

With d=4d=4, the expansion has 15 quadratic terms; at width 128, it has 8385.

This resembles the polynomial kernel in machine learning. The polynomial kernel k(x1,x2)=(γ x1⋅x2+c)dk(x_1,x_2)=(\gamma\, x_1\cdot x_2+c)^d computes in a high-dimensional polynomial feature space without explicitly expanding the features. The star operation similarly computes in low dimensions to obtain a high-dimensional representation.

Stack more layers and dimensionality keeps growing through repeated doubling. Multiplying the first layer's quadratic terms again in the second layer gives fourth-order terms. The authors calculate an implicit dimensionality of roughly 90102490^{1024} for a width-128, 10-layer network, effectively infinite for practical purposes.

It is worth pausing here, though. Fifteen coefficients may sound like many, but they all come from two vectors, w1w_1 and w2w_2, producing a coefficient matrix of rank only 2. One output channel cannot choose quadratic coefficients arbitrarily. The dimension is high, but the coefficients are tightly constrained. In the discussion, the authors also note that coefficients in the implicit dimensions cannot be adjusted as freely as ordinary network weights. This may explain why extremely high implicit dimensionality yields only moderate gains.

Figure 2 from the paper: four two-dimensional scatterplots show orange and green points arranged as interlocking crescents. The top row contains neural networks: sum operation on the left gives a slanted straight decision boundary, while star operation on the right produces a curved boundary that follows the crescents. The bottom row contains SVMs: the Gaussian Kernel on the left gives a rounded green region, while the Polynomial Kernel on the right resembles the star-operation boundary above.
Figure 2 from Ma et al., taken from PDF page 5. The original caption is omitted.

The authors plot decision boundaries on two-moons data. The additive network draws a straight line; the multiplicative network draws a curve resembling a polynomial-kernel SVM more closely than a Gaussian-kernel SVM.

Even Without Activation Functions

If multiplication itself supplies nonlinearity, what happens with no activation functions anywhere? Take XOR: quadrants one and three form one class; quadrants two and four form the other. No straight line can separate them. Adding two linear branches keeps the network linear from end to end, so it gets about half right. Multiplying them introduces the x1x2x_1x_2 term, exactly what XOR needs.

The paper tries the same on DemoNet at width 192 and depth 12. Removing every activation drops the additive network from 66.2% to 32.4%, while the multiplicative network falls only from 71.7% to 70.5%.

StarNet

Since multiplication helps most in narrow networks, the authors build a lightweight network around it, called StarNet.

Figure 3 from the paper: the overall StarNet pipeline at the top takes a starry-sky image through Conv (BN, ReLU6), then stage1 through stage4. Each stage contains a Conv and a stack of Star Blocks; channels increase from d to 8d and resolution falls from H/4 to H/32, followed by GAP and FC. The lower-left star block has DW-Conv and BN, then two FC branches expanding d to 4d, one with ReLU6. They multiply at a star, pass through FC to return to d, then BN and DW-Conv, with an outer residual connection. The lower-right legend specifies Conv ks=3, stride=2; DW-Conv ks=7, stride=1; the star means elementwise multiplication.
Figure 3 from Ma et al., taken from PDF page 6. The original caption is omitted.

The architecture is deliberately plain. Four stages each begin with a stride-2, 3×3 convolution to downsample and double channels. The blocks modify DemoNet in a few ways. BatchNorm replaces LayerNorm and moves after the depthwise convolution so it can be merged at inference. GELU becomes MobileNetV2's ReLU6. Another depthwise convolution is added at the block's end, and both branches expand channels by 4.

The authors use none of the familiar extras—reparameterization, attention, or SE—to avoid obscuring the star operation's contribution. Four sizes vary only the first-stage channel count and blocks per stage. The smallest S1 has 2.9M parameters and 425M FLOPs; the largest S4 has 7.5M and 1075M.

Discussion

ImageNet

Training follows the DeiT recipe for 300 epochs. Batch-1 latency is measured on an iPhone 13, a P100 GPU, and an Intel E5-2680 CPU.

Table: selected rows from the paper's Table 6; latencies in milliseconds on an iPhone 13, a GPU and a CPU.
Modeltop-1ParamsFLOPsiPhoneGPUCPU
MobileOne-S071.4%2.1M275M0.71.12.2
FasterNet-T071.9%3.9M338M0.72.55.7
StarNet-S173.5%2.9M425M0.72.34.3
MobileOne-S175.9%4.8M825M0.91.56.0
EfficientNet-B077.1%5.3M390M1.63.48.8
StarNet-S377.3%5.8M757M0.92.76.7
MobileOne-S277.4%7.8M1299M1.02.08.9
EdgeViT-XS77.5%6.8M1166M3.512.118.3
StarNet-S478.4%7.5M1075M1.03.79.4

StarNet looks good on the iPhone 13. At the same 0.7 ms, S1 gains 2.1 percentage points over MobileOne-S0. S4 gains 0.9 points over EdgeViT-XS and runs 3.5 times as fast.

GPU and CPU results differ. StarNet-S4 takes 3.7 ms on the P100 against MobileOne-S2's 2.0 ms; on CPU, 9.4 versus 8.9 ms also favors MobileOne slightly. StarNet's strength lies on phones. It is much faster than hybrid architectures such as EdgeViT on all three devices, while its comparison with MobileOne depends on the device.

Where to Put Multiplication

The authors replace multiplication with addition in selected StarNet-S4 stages:

Table: selected rows from the paper's Table 7.
Stage 1Stage 2Stage 3Stage 4top-1
AddAddAddAdd75.3%
MultiplyMultiplyAddAdd75.2%
MultiplyMultiplyMultiplyAdd76.8%
AddAddMultiplyMultiply78.4%
MultiplyMultiplyMultiplyMultiply78.4%

Replacing all multiplication costs 3.1 percentage points. Yet multiplication in the first two stages makes little difference: using it only in the last two matches using it throughout. The authors suggest that the first two stages are too narrow and ReLU6 zeros many features, also zeroing their quadratic products, so the high-dimensional benefit cannot emerge.

They also test activation placement. No activations gives 75.6%; one branch gives 78.4%; both branches give 78.0%; activation after multiplication gives 77.0%. Applying it to just one branch works best.

Transforming only one branch and leaving the other as the input xx, written (W2 act(W1x))∗x(W_2\,\mathrm{act}(W_1 x)) * x, drops accuracy to 74.4% at matched compute. Both branches need linear transformations to generate enough quadratic terms in the expansion.

The Cost of Speed

Multiplication is theoretically a little costlier than addition. Measurements find equal speed on iPhone and GPU; multiplication is slightly slower on CPU, with StarNet-S4 taking 9.4 versus 8.4 ms.

There is another issue the paper leaves open. When a GitHub user asks about quantization, the author replies that it has not been tried. Another user notes that multiplying two features can push values outside the INT8 range. That step needs your own validation before phone deployment.

Conclusion

This paper turns a widely used operation with competing explanations into one readable expansion. Multiplying two linear branches forms a linear combination of roughly d2/2d^2/2 quadratic terms; stacking layers keeps increasing the implicit dimension. It also explains why multiplication helps narrow networks most: dimension is exactly what they lack.

The rank-2 coefficient matrix shows the constraint as well. There are many expanded terms but few freely adjustable coefficients. In DemoNet and StarNet, “near-infinite dimensions” translate into gains of 3 to 6.5 percentage points.

timm provides pretrained weights from starnet_s1 to starnet_s4. If your lightweight model needs better accuracy, find an addition sign in its blocks and try replacing it with multiplication.