---
title: 'Filter Trimming in CNNs: ConvV2 & C-K-S'
url: https://www.emergentmind.com/topics/filter-trimming-convv2-c-k-s
type: topic
---

# Filter Trimming in CNNs: ConvV2 & C-K-S

Filter trimming is a family of structured techniques designed to reduce the computational and memory cost of convolutional neural networks (CNNs) by strategically reducing, or “trimming,” the number of filters, kernel spatial extent, or zero-padding footprints in convolutional layers. The variants known as ConvV2 and C-K-S correspond to algorithmic and architectural methodologies that aggressively target redundant or zero-contributing weights and spatial supports. These strategies enable substantial savings in FLOPs and real-world inference times, while maintaining accuracy and compatibility with existing hardware platforms.

## 1. Mathematical Foundations of Filter Trimming

Filter trimming methods systematically remove redundancy at one or more structural axes of the convolutional operator:

- **Channel (C) trimming**: removes whole output filters/channels, leading to smaller activation maps and filter banks.
- **Kernel (K) trimming**: reduces the spatial extent of filters, typically by removing outer stripes or “slices” of the kernel’s support.
- **Spatial (S) trimming**: prunes individual weights, possibly resulting in sparse or structured-sparse kernels.

A formalization of channel- and kernel-wise pruning via matrix sketching is given in FilterSketch:

Given pre-trained conv weights \(W \in \mathbb{R}^{d \times c}\) (with \(d = c_\mathrm{in} \times h \times w\), \(c\) output channels), one seeks a reduced matrix \(\Omega \in \mathbb{R}^{d \times \tilde{c}}\) (\(\tilde{c} < c\)) such that

\[
\min_{\Omega}\ \| W W^T - \Omega \Omega^T \|_F
\]

This objective preserves the second-order (covariance) structure of the filters, thus retaining the representational capacity of the layer under aggressive channel or spatial pruning [2001.08514].

SMOF generalizes spatial support trimming by attaching learnable “filter skeleton” masks to each kernel, and using group-sparsity norms to drive entire spatial stripes to zero:

\[
L(W, \mathrm{FS}, \mathrm{FM}) = \sum_{(x,y)\in \mathcal{D}} \text{loss}(f(x; W \odot \mathrm{FS} \odot \mathrm{FM}), y)
 + \sum_{\ell,i} \alpha_i^\ell \| \mathrm{FS}_i^\ell \|_g
 + \sum_\ell \beta \| \mathrm{FM}^\ell \|_1
\]

where “\(\odot\)” is broadcast-multiplication, FS are spatial masks, FM are per-channel gates, and the group norm couples the edges of concentric squares [2110.10842].

## 2. ConvV2 and C-K-S Algorithms: Procedures and Implementation

**ConvV2** systematically removes zero-padding effects at convolution boundaries by adjusting the computation window for each output spatial position. For any location, only the weights that actually multiply nonzero input entries contribute:

Given inputs \(X\), filters \(W\), stride \(s\), and padding \(p\):

\[
Y_{n,o,i,j} = \sum_{c=0}^{C-1} \sum_{\alpha,\beta} X_{n,c,i s_h+\alpha+f_h^s-p_h,\, j s_w+\beta+f_w^s-p_w} \cdot \tilde{W}_{o,c,\alpha,\beta}
\]
where
\[
\begin{aligned}
f_h^s &= \max(p_h - i s_h, 0) \\
f_h^e &= \min(H_\mathrm{in} - i s_h + p_h, F_h)
\end{aligned}
\]
and similarly for the width [2306.15951].

**C-K-S** extends ConvV2 to backward-propagation and dilated operations, employing:

- **KS-deconv**: Kernel-Split deconvolution transforms stride-s operations into dense convolutions on sub-kernels, eliminating unnecessary multiply-accumulate due to inserted zeros.
- **Sk-dilated**: For dilated convolutions, stride through X/VY at dilation steps, skipping memory and computation for zeros.

These approaches can be combined with other classical acceleration techniques (e.g., Winograd transformations as in [2004.05607]).

## 3. Representative Structured Pruning Frameworks

Below is a comparative summary of several frameworks relevant to ConvV2 and C-K-S trimming:

| Approach      | Key Axes Pruned         | Pruning Principle           | Hardware Policy    |
|---------------|------------------------|-----------------------------|--------------------|
| **FilterSketch** [2001.08514] | C, K, S | Matrix sketching via Frequent Directions | General |
| **SMOF** [2110.10842] | C, K (square S) | Learnable masks/stripes + group sparsity | SIMD-aligned, off-the-shelf |
| **C-K-S** [2306.15951] | Zero-padding, K (split), S (stride) | Algorithmic skipping of zeros | GPU, hardware-efficient |
| **Winograd/Minimal Filtering** [2004.05607] | K | Algorithmic tile-based transform | FPGA, ASIC |

- **FilterSketch** leverages information-theoretic sketching and is axis-agnostic (matrix view adapts to unfolding filters along C, K, or S).
- **SMOF**’s “peeling” is hardware-friendly: kernel-size reductions yield native speedups on ARM, Adreno, and DSPs without width-alignment penalties.
- **C-K-S** integrates filter trimming by removing “dead” zeros (arising from padding or sparsity) and composes deconvolutions/dilations as standard dense convolutions for better SIMD utilization.

## 4. Practical Algorithms and Pseudocode

**C–K–S FilterSketch for ConvV2** [2001.08514]:

```
for each conv-layer W (shape [co,ci,h,w]):
  # 1. Channel-trim
  matC = reshape(W, [ci*h*w, co])
  OmegaC = FD_Sketch(matC, keep_co)
  OmegaC = OmegaC / FroNorm(OmegaC)
  Wc = reshape(OmegaC, [ci, h, w, keep_co]).permute([3,0,1,2])

  # 2. Kernel-trim
  matK = reshape(Wc, [keep_co*ci, h*w])
  OmegaK = FD_Sketch(matK, keep_hw)
  OmegaK = OmegaK / FroNorm(OmegaK)
  WK = reshape(OmegaK, [keep_co,ci,keep_hw]).unfold_spatial_to(h,w)

  # 3. (optional) Spatial-trim
  for each surviving filter in WK:
     prune small |weights| or FD_Sketch on flatten spatial -> keep_spat
Initialize new ConvV2 with weights WK, then fine-tune.
```

**C-K-S Algorithm for efficient GPU convolution** [2306.15951]:

```
for each (n,o,i,j) in Y:
  ih0 = i*s_h - p_h
  jw0 = j*s_w - p_w
  fhs = max(-ih0,0)
  fhe = min(H_in-ih0, F_h)
  fws = max(-jw0,0)
  fwe = min(W_in-jw0, F_w)
  Y[n,o,i,j] = 0
  for c in [0,C), α in [fhs,fhe), β in [fws,fwe):
    Y[n,o,i,j] += X[n,c,ih0+α,jw0+β]*W[o,c,α,β]
```

## 5. Computational Complexity and Empirical Results

Filter trimming achieves substantial reductions in resource utilization:

- **ConvV2/CKS**: Arithmetic costs are reduced by factors proportional to the ratio of retained filter support: \( \mathrm{savings} \approx (F_h' F_w') / (F_h F_w) \).
- **KS-deconv/Sk-dilated**: Multiplicative cost reduction by \( 1/(s_h s_w) \) for stride/dilated ops.

Empirically, ConvV2 and C-K-S implementations consistently surpass cuDNN/PyTorch for small-to-medium feature maps by 1.1×–1.8× on modern GPUs, while maintaining identical accuracy and convergence profiles [2306.15951]. On ImageNet, FilterSketch achieves FLOPs reductions of 45.5% with accuracy drops under 1% (ResNet-50: –0.69% Top-5) [2001.08514]. SMOF reports wall-time reductions exceeding the corresponding FLOPs drop on DSP and GPU, due to alignment-friendly kernel size reduction [2110.10842].

## 6. Limitations, Hardware Compatibility, and Extensions

Limitations stem from hardware and tiling overheads:

- For ConvV2 trimming, benefit is realized only when the fraction of computations due to padding is non-negligible (padded-zero proportion >6%). For large spatial maps with minimal padding, pointer adjustment costs can outweigh computational gains [2306.15951].
- Channel-trimming alone on CPUs/GPUs may incur alignment penalties due to SIMD width. SMOF, by jointly reducing channel and kernel size in square fashion, is not subject to this, enabling practical acceleration on off-the-shelf hardware [2110.10842].
- Extensions include fusion with Winograd minimal filtering (saving 30–45% of multipliers for 3×3, 5×5 filters on FPGAs/ASICs), grouping and depthwise pruning, and hardware hard-wiring of C–K–S transformations [2004.05607].

## 7. Conclusion and Comparative Perspective

Filter trimming—especially as instantiated in the ConvV2 and C-K-S methodologies—encompasses algorithms that aggressively and efficiently remove structural and arithmetic redundancy from convolutional neural networks. Approaches range from information-theoretic matrix sketching, group-sparsity-based regularization, to direct algorithmic skipping of zeros and kernel support. These methodologies enable FLOPs reductions of 30–60%, maintain accuracy to within 1%, and yield measurable speedups on both commodity and embedded platforms. C-K-S in particular provides a hardware-friendly path for achieving efficiency by unifying architectural and algorithmic pruning into a single, SIMD-optimized policy [2306.15951][2001.08514][2110.10842][2004.05607].

Source: https://www.emergentmind.com/topics/filter-trimming-convv2-c-k-s