ResNeXt Block
Grouped convolutions without leaving the graph
- block
ResNeXt is the answer to the question "what if a residual block didn't have to be one wide path, but many narrow ones running in parallel?" CdlResNeXtBlock builds one of those blocks as a node - the grouped-convolution descendant of the ResNet block, from the Dive into Deep Learning textbook. If you've already clicked your way through CdlResidual and want to see the next idea on the family tree, this is it.
The idea is elegant: split the middle convolution into groups independent groups, each learning its own representation, then concatenate them back. You get "multiple brains" for roughly the same parameter count as one wide convolution. That's the trick that lets ResNeXt beat ResNet at equal cost - the same FLOPs, spent on more, thinner branches, apparently learns more diverse features.
What the block contains
A bottleneck structure:
- 1×1 convolution to reduce channels
- a 3×3 grouped convolution - this is the ResNeXt signature
- 1×1 convolution to expand back out
- an optional shortcut path (1×1 conv), matching what you saw in the plain residual block
The inputs
num_channels- output channels (default 64).groups- number of groups for the grouped conv (default 32). Each group handleschannels / groupsfilters. This is the knob that defines a ResNeXt; crank it up for the "cardinality" effect.bot_mul- bottleneck channel multiplier (default 0.5): the middle 3×3 conv runs atnum_channels * bot_mulchannels before the 1×1s do their thing.use_1x1conv- the shortcut, same rule as CdlResidual: turn it on when stride or channels change, or the skip-add will hit a shape error.strides- convolution stride (1–4), the downsampling control.
Output: block, a cdlModel.
Installing ComfyDL
The pack-wide light install:
cd ComfyUI/custom_nodes
git clone https://github.com/Cynthia-lxx/ComfyDL
cd ComfyDL && pip install -r requirements.txt
Restart ComfyUI; it's under ComfyDL → CV Models, or search "ComfyDL" in ComfyUI Manager. matplotlib is the only added dependency; nothing to download.
What to actually experiment with
The groups value is where the fun is. With groups=1 you've basically got a plain bottleneck ResNet block - the ResNeXt reduces to the old idea. Crank groups up to 32 and you're in real ResNeXt territory: 32 parallel "brains" that produce a model whose effective width feels much larger than its parameter count. Feed two versions - groups=1 vs groups=32 at the same channel count - into Plot on a small training run and you can literally watch the cardinality effect on the loss curves. That's the kind of experiment this pack exists for.
The one real trap is shared with the plain residual block: strides > 1 or a channel change without use_1x1conv = immediate shape error. The block is untrained and random-initialized like everything else here - no pretrained weights, so treat it as a construction kit, not a shortcut to a working model.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| num_channels | INT | 641–2048 | — |
| groups | INT | 321–1024 | — |
| bot_mul | FLOAT | 0.5000.125–2 | — |
| use_1x1conv | BOOLEAN | false | — |
| strides | INT | 11–4 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| block | cdlModel | — |