Design and Behavior of Sparse Mixture-of-Experts Layers in CNN-based Semantic Segmentation
Organizations: FZI Research Center for Information Technology · Karlsruhe Institute of Technology (KIT)
Abstract
Sparse mixture-of-experts (MoE) layers have been shown to substantially increase model capacity without a proportional increase in computational cost and are widely used in transformer architectures, where they typically replace feed-forward network blocks. In contrast, integrating sparse MoE layers into convolutional neural networks (CNNs) remains inconsistent, with most prior work focusing on fine-grained MoEs operating at the filter or channel levels. In this work, we investigate a coarser, patch-wise formulation of sparse MoE layers for semantic segmentation, where local regions are routed to a small subset of convolutional experts. Through experiments on the Cityscapes and BDD100K datasets using encoder-decoder and backbone-based CNNs, we conduct a design analysis to assess how architectural choices affect routing dynamics and expert specialization. Our results demonstrate consistent, architecture-dependent improvements (up to +3.9 mIoU) with little computational overhead, while revealing strong design sensitivity. Our work provides empirical insights into the design and internal dynamics of sparse MoE layers in CNN-based dense prediction. Our code is available at https://github.com/KASTEL-MobilityLab/moe-layers/.
Figures & tables
| Architecture | Number of parameters | GFLOPs | Inf. time | mIoU in % | ||
| total | active | per image, ms | Cityscapes | BDD100K | ||
| ENet | ||||||
| Baseline | 351,660 | 8.72 | 12.04 | 51.80 | 52.27 | |
| PatchConvMoE, Conv-GAP gate | 352,956 (+0.36%) | 352,092 (+0.12%) | 8.73 (+0.11%) | 25.15 (+108.89%) | 53.33 (+1.53) | 53.43 (+1.16) |
| PatchConvMoE, 2Conv-GAP gate | 353,548 (+0.54%) | 352,684 (+0.29%) | 8.74 (+0.23%) | 25.20 (+109.30%) | 55.70 (+3.90) | 53.70 (+1.43) |
| PatchConvMoE, 3Conv-GAP gate | 354,140 (+0.71%) | 353,276 (+0.46%) | 8.76 (+0.46%) | 25.26 (+109.80%) | 50.82 | 53.60 (+1.33) |
| Patch size in px | ENet | ERFNet | U-Net | LR-ASPP | DeepLabv3+ | PSPNet | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| mIoU in % | Grid size | mIoU in % | Grid size | mIoU in % | Grid size | mIoU in % | Grid size | mIoU in % | Grid size | mIoU in % | Grid size | |
| No patchification | 31.37 | - | 16.25 | - | 57.95 | - | 55.12 | - | - | 64.47 | - | |
| Patch size 8 8 px | 51.26 | 48 48 | 60.31 | 24 24 | 16.50 | 96 96 | 58.93 | 48 48 | 77.14 | 24 24 | 70.44 | 12 12 |
| Patch size 16 16 px | 51.69 | 24 24 | 60.24 | 12 12 | 18.35 | 48 48 | 60.68 | 24 24 | 77.41 (+0.15) | 12 12 | 72.92 | 6 6 |
| Patch size 32 32 px | 52.97 (+1.17) | 12 12 | 61.46 (+0.80) | 6 6 | 20.09 | 24 24 | 61.36 | 12 12 | 77.49 (+0.23) | 6 6 | 75.63 (+2.58) | 3 3 |
| Patch size 64 64 px | 53.56 (+1.76) | 6 6 | 61.98 (+1.32) | 3 3 | 28.02 | 12 12 | 66.94 (+0.15) | 6 6 | 77.61 (+0.35) | 3 3 | 75.02 (+1.97) | 1 1 |
| Loss | ENet | ERFNet | U-Net | LR-ASPP | DeepLabv3+ | PSPNet | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| top-1 | top-2 | top-1 | top-2 | top-1 | top-2 | top-1 | top-2 | top-1 | top-2 | top-1 | top-2 | |
| No loss | 54.13 (+2.33) | 55.72 (+3.92) | 59.58 | 59.44 | 56.59 | 57.02 | 67.47(+0.68) | 67.11 (+0.32) | 78.05 (+0.79) | 77.66 (+0.40) | 70.21 | 70.35 |
| 51.92 (+0.12) | 55.70 (+3.90) | 62.04 (+1.38) | 61.98 (+1.32) | 62.83 | 63.88 | 68.47 (+1.68) | 68.63 (+1.84) | 77.50 (+0.24) | 77.61 (+0.35) | 62.08 | 75.63 (+2.58) | |
| 53.76 (+1.96) | 53.29 (+1.49) | 59.05 | 62.12 (+1.46) | 66.03 (+1.09) | 67.21 (+2.27) | 67.19 (+0.40) | 67.35 (+0.56) | 77.41 (+0.15) | 77.55 (+0.29) | 64.97 | 76.25 (+3.20) | |
| 53.75 (+1.95) | 54.55 (+2.75) | 59.36 | 60.86 (+0.20) | 64.42 | 65.24 (+0.30) | 67.23 (+0.44) | 67.49 (+0.70) | 77.30 (+0.04) | 77.27 (+0.01) | 66.99 | 75.46 (+2.41) | |
| Number of | Total number of | mIoU in % | |||
|---|---|---|---|---|---|
| experts | parameters | top-1 | top-2 | top-4 | top-8 |
| ENet | |||||
| 2 | 352,252 | 52.09 (+0.29) | 53.86 (+2.06) | - | - |
| 4 | 352,684 | 48.64 | 53.84 (+2.04) | 51.97 (+0.17) | - |
| 8 | 353,548 | 51.68 | 55.70 (+3.90) | 50.98 | 54.16(+2.36) |
| 16 | 355,276 | 52.07 (+0.27) | 52.19 (+0.39) | 52.05 (+0.25) | 50.42 |
| Experts | Parameters | Routing | mIoU in % |
|---|---|---|---|
| 8 independent experts | 353,548 | top-1 | 51.68 |
| top-2 | 55.70 (+3.90) | ||
| 8 independent + 1 shared experts | 353,692 | top-1 | 51.45 |
| top-2 | 50.21 | ||
| 8 independent + 2 shared experts | 353,836 | top-1 | 54.89 (+3.09) |
| top-2 | 50.14 |
| Num MoE | MoE Layer position | Patch | Total number of | mIoU |
| layers | size, px | parameters | in % | |
| ENet | ||||
| 1 | 3 3 conv layer in first encoder regular block ( regular1_1 ) | 64 64 | 369,532 | 53.56 (+1.76) |
| 1 | 3 3 conv layer in bridge regular block ( regular3_4 ) | 32 32 | 419,068 | 54.80 (+3.00) |
| 1 | Last 3 3 conv layer in the decoder ( regular5_1 ) | 128 128 | 353,548 | 55.70 (+3.90) |
| 2 | regular3_4 and regular5_1 | 32 32,128 128 | 420,956 | 36.46 |
| Model | ||||||
|---|---|---|---|---|---|---|
| NRE | TEC | NRE | TEC | NRE | TEC | |
| ENet | 0.9255 | 0.4394 | 0.5764 | 0.7425 | 0.8877 | 0.5024 |
| ERFNet | 0.9686 | 0.5183 | 0.8057 | 0.7790 | 0.8408 | 0.5563 |
| U-Net | 0.9887 | 0.4409 | 0.9880 | 0.4894 | 0.9874 | 0.5330 |
| LR-ASPP | 0.9951 | 0.2951 | 0.7701 | 0.6193 | 0.9468 | 0.4931 |
| DeepLabv3+ | 0.9660 | 0.4379 | 0.9606 | 0.3888 | 0.8629 | 0.4724 |