Convolutional Network Design Spaces (RegNet) the AnyNet template · population error CDFs · progressive space refinement · quantized linear widths · RegNetX32
From Hand-Crafted Models to Population Design Spaces
Motivation & Limits of Single-Model Search
Limits of point search: Manual tuning and NAS search a 1.8 \times 10^{18} haystack for a single model at one budget, yielding opaque stage depths like (3,4,6,3) or (3,3,9,3).
Design-space distillation (RegNet, Radosavovic et al., 2020): Sample n=500 models per parameterized space and compare empirical error CDFs \hat{F}(e) to discover simple structural rules that generalize across all FLOP regimes.
The AnyNet Design Space: 16 Degrees of Freedom
The Unconstrained Template
The AnyNet template fixes the stem–body–head macro layout while leaving four hyperparameters free in each of its four stages (i = 1, 2, 3, 4):
Fixed stem & head: A stride-2 3\times 3 stem (c_0 = 32 ch, BN, ReLU) and a global-average-pooling + linear head.
Four free numbers per stage (d_i, c_i, b_i, g_i): Stage i stacks d_i ResNeXt blocks (§7.4) with output channels c_i, bottleneck compression ratio b_i \in \{1, 2, 4\} (so bottleneck width is c_i / b_i), and group widthg_i \in \{1, 2, \ldots, 32\} (so group count is (c_i / b_i)/g_i).
In AnyNet, each stage is specified by a 4-tuple (depth, num_channels, groups, bot_mul) where bot_mul= 1/b_i, and the opening block of every stage downsamples with strides=2:
Stochastic dominance: If \hat{F}_1(e) lies above and to the left of \hat{F}_2(e), a random network from space 1 beats any error threshold e with higher probability.
Population view: Evaluates the entire distribution of valid architectures rather than noisy single-point optima.
Design-Space Refinement: AnyNetXA to AnyNetXE
ImageNet Population Evidence
Sampling n = 500 models per space at \approx 400\text{M} multiply-adds (10 ImageNet epochs) distills four structural rules:
\text{AnyNetX}_A \to \text{AnyNetX}_B (shared b_i = b): Tying one bottleneck ratio across stages preserves the CDF (49.3\% \to 49.1\% mean error), dropping 3 knobs.
\text{AnyNetX}_B \to \text{AnyNetX}_C (shared g_i = g): Tying one group width across stages also preserves the CDF (49.1\%, dropping 3 more knobs).
\text{AnyNetX}_C \to \text{AnyNetX}_D (growing widths c_{i+1} \ge c_i): Cuts mean error by 6 points to 43.3\% (shrinking widths c_{i+1} < c_i degrade to 63.0\%).
\text{AnyNetX}_D \to \text{AnyNetX}_E (growing depths d_{i+1} \ge d_i): Trims mean error to 42.8\%(16 \to 10 constrained stage knobs).
Tallying Multiply-Adds Across an AnyNet Instance
FLOP Budget Accounting
def mult_adds(arch, r, stem_channels=32, group_width=16, num_classes=10):"""Multiply-adds of an AnyNet with k = 1 for one r x r image; arch holds (depth, width) for each stage.""" r //=2# The stem halves the resolution total, c_in = r * r *9* stem_channels, stem_channels # Grayscale inputfor d, c in arch: total += r * r * c_in * c # First 1 x 1 convolution, before the stride r //=2 total += r * r * c_in * c # 1 x 1 convolution of the shortcut total += r * r * c * c * (2* d -1) # The other 1 x 1 convolutions total += r * r *9* group_width * c * d # Grouped 3 x 3 convolutions c_in = creturn total + c_in * num_classes # Linear head
Linear grouped 3 \times 3 cost: With b=1 and group width g, groups = c/g, so grouped 3 \times 3 MACs = 9 r^2 g c per block.
Sampling Compute-Matched Candidate Architectures
Rejection Sampling at 112M MACs
sample_arch draws random depths d_i \in \{1,\ldots,8\} and distinct widths c_i \in \{16, 32, \ldots, 256\}, sorts the widths to enforce c_1 < c_2(increasing=True) or c_1 > c_2(increasing=False), and accepts models within \pm 20\% of our 112\text{M} multiply-add budget:
def sample_arch(rng, increasing, r=96, budget=112e6):"""Depths and widths of two stages at about `budget` multiply-adds."""whileTrue: depths = rng.integers(1, 9, size=2).tolist() widths =sorted(rng.choice(np.arange(16, 257, 16), 2, replace=False) .tolist(), reverse=not increasing) arch =tuple(zip(depths, widths))ifabs(mult_adds(arch, r) / budget -1) <=0.2:return archrng = np.random.default_rng()for increasing in (True, False): arch = sample_arch(rng, increasing)print(arch, f'{mult_adds(arch, 96) /1e6:.0f} million multiply-adds')
((3, 32), (6, 208)) 114 million multiply-adds
((3, 112), (6, 96)) 109 million multiply-adds
Testing Growing vs. Shrinking Widths on Fashion-MNIST
Small-Scale Population Experiment
We sample n = 12 two-stage networks with growing widths (c_1 < c_2) and 12 with shrinking widths (c_1 > c_2) at 112\text{M} \pm 20\% multiply-adds and train each for 1 epoch on 96\times 96 Fashion-MNIST:
Task-complexity sensitivity: Whereas c_{i+1} \ge c_i separates ImageNet population means by 20 percentage points(43\% vs. 63\%), on 10-class Fashion-MNIST the two CDFs differ by under 1 percentage point (mean error \approx 12\%, best \approx 11\%).
Scientific takeaway: On a simple grayscale dataset where almost any reasonable convnet hits \approx 88\% in one epoch, early high-resolution stages do not starve top-stage semantic capacity. Design rules are never dataset-independent laws.
increasing widths: mean error 0.119, minimum 0.114
decreasing widths: mean error 0.124, minimum 0.112
The RegNetX Family: Quantized Linear Width Staircases
Quantized linear staircase: Block widths follow a linear ramp (u_0, a) snapped to geometric stages s_j = \operatorname{round}(\log(u_j/u_0)/\log m).
No bottleneck (b = 1): Collapses 16 stage hyperparameters into (d, u_0, a, m, g).
Constructing RegNetX32 for Fashion-MNIST
RegNetX32 Implementation
Following the RegNetX rules (b = 1, shared group width g = 16, growing depths d_1 < d_2, growing widths c_1 < c_2), we build a 32-layer, two-stage RegNetX32(1\text{ stem} + (4 + 6) \times 3\text{ block convs} + 1\text{ head} = 32\text{ layers}):
class RegNetX32(AnyNet):def__init__(self, lr=0.1, num_classes=10, num_steps=None): stem_channels, group_width, bot_mul =32, 16, 1 depths, channels = (4, 6), (64, 160)super().__init__( # The number of groups is c_i / gtuple((d, c, c // group_width, bot_mul)for d, c inzip(depths, channels)), stem_channels, lr, num_classes)self.num_steps = num_steps # Length of the learning-rate schedule
We train both RegNetX32 and ResNet18 for 10 epochs on 96\times 96 Fashion-MNIST under the exact same AnyNet optimizer (SGD with momentum 0.9, coupled weight decay 10^{-3}, 1-epoch linear warmup to \eta_0 = 0.1 + cosine decay):
Model (96^2, 10 ep)
Params
Multiply-Adds
Val Accuracy
ResNet-18 (4 stages)
11.18\text{M}
319\text{M}
\approx 94.0\%
RegNetX32 (2 stages)
0.52\text{M}
112\text{M}
\approx 94.0\%
RegNetX-400MF..1.6GF
4.8\text{--}8.3\text{M}
150\text{--}600\text{M}
93\text{--}94\%
21\times fewer weights, 3\times fewer MACs:RegNetX32 matches ResNet-18’s \approx 94\% accuracy using <5\% of its parameters.
Subclassing AnyNet to Compare ResNet-18 Fairly
Matched-Protocol Baseline
Because ResNet-18 shares the stem–body–head template, we subclass AnyNet and override stem and stage with d2l.Residual so both models inherit the exact same momentum-SGD + weight-decay optimizer:
519,658 parameters, validation accuracy 0.938
11,175,370 parameters, validation accuracy 0.937
Three Nuances: Optimizer Coupling, Ceiling & Latency
Systems & Experimental Pitfalls
1. Architecture–optimizer coupling: Without momentum + weight decay, RegNetX32 drops to \approx 91\% vs. ResNet-18’s \approx 93\%.
2. Dataset ceiling: Larger 4-stage RegNets plateau at the same \approx 94\% Fashion-MNIST ceiling.
3. GPU latency:RegNetX32 (32 layers, grouped) takes roughly 1.5\times as long per epoch as ResNet-18 (18 layers, dense) at a third of the multiply-adds: runtime tracks activations, not FLOPs. At comparable FLOPs, RegNets run up to 5\times faster than EfficientNets.
Concept Check: Quantized Staircases, Group Counts & EDFs
Concept Check
Test your understanding of design spaces and RegNet parameterization:
Group count vs. group width: In RegNetX32, stage 1 has width c_1 = 64 and stage 2 has width c_2 = 160, both with bottleneck ratio b = 1 and shared group widthg = 16. How many groups (groups = (c_i / b) // g) does the 3\times 3 convolution use in stage 1 and in stage 2?
Quantized linear staircase: Suppose a RegNet has initial width u_0 = 24, slope a = 36, and geometric step ratio m = 2.5. For block j = 2, what is the unquantized linear width u_2, what stage index s_2 = \operatorname{round}(\log(u_2/u_0)/\log m) does it snap to, and what is \tilde{u}_2 = u_0 m^{s_2}?
Reading empirical CDFs: Suppose space \mathcal{A} has a single outlier model with 18\% error but mean error 52\%, while space \mathcal{B} has minimum error 19\% and mean error 42\% with \hat{F}_\mathcal{B}(e) > \hat{F}_\mathcal{A}(e) for all e > 20\%. Why does design-space methodology prefer \mathcal{B}?
Concept Check: Quantized Staircases, Group Counts & EDFs (Answers)
Concept Check
Answers:
Stage 1:64 / 16 = \mathbf{4\text{ groups}}. Stage 2:160 / 16 = \mathbf{10\text{ groups}}. Keeping group width g = 16 constant forces the number of parallel groups (cardinality) to grow proportionally with stage width.
u_2 = 24 + 36(2) = 96. Since \log(96/24) / \log(2.5) = \log(4) / \log(2.5) \approx 1.386 / 0.916 \approx 1.513, rounding gives stage index s_2 = \mathbf{2} and quantized width \tilde{u}_2 = 24 \times 2.5^2 = \mathbf{150} (which rounds to 152 as a multiple of 8).
A single lucky point sample is noisy and non-transferable across compute budgets; uniform stochastic dominance (\hat{F}_\mathcal{B} > \hat{F}_\mathcal{A}) proves the structural constraint systematically enriches the entire distribution of valid networks.