---
title: 'CAFormer: Hybrid Conv-Attention Vision Backbone'
url: https://www.emergentmind.com/topics/caformer
type: topic
---

# CAFormer: Hybrid Conv-Attention Vision Backbone

CAFormer most commonly denotes a hybrid MetaFormer vision backbone introduced in “MetaFormer Baselines for Vision,” where depthwise separable convolutions are used in the bottom two stages and vanilla self-attention in the top two stages, i.e., \(T=(\mathrm{Conv}, \mathrm{Conv}, \mathrm{Attn}, \mathrm{Attn})\) [2210.13452]. In later literature, the same name has also been reused for a transformer-based mechanism for combinatorial auctions [2501.19219] and, with different capitalization, for a causal time-series framework titled “Caformer” [2403.08572]. The term therefore refers to distinct architectures across domains; within computer vision, however, CAFormer specifically designates a hierarchical MetaFormer backbone that couples local convolutional token mixing with global attention-based token mixing.

## 1. MetaFormer provenance and the CAFormer design rationale

CAFormer was introduced as one of the principal instantiations in the MetaFormer framework, which abstracts the Transformer into a generic block structure without committing to a specific token mixer. Given an input image \(I\), MetaFormer first forms tokens,
\[
X = \mathrm{InputEmbedding}(I),
\]
and then repeatedly applies
\[
X' = X + \mathrm{TokenMixer}\!\left(\mathrm{Norm_1}(X)\right),
\]
\[
X'' = X' + \sigma\!\left(\mathrm{Norm_2}(X')W_1\right)W_2.
\]
Within this template, CAFormer is defined by stage-wise heterogeneity in the token mixer rather than by a new block skeleton: convolutional token mixing is used early, and self-attention is used late [2210.13452].

The paper positions CAFormer as evidence for two related claims. First, much of modern vision-backbone performance comes from the MetaFormer scaffold itself rather than from any single specialized mixer. Second, “old-fashioned” operators can remain competitive when inserted into that scaffold appropriately. In that framing, CAFormer operationalizes a division of labor: early stages use depthwise separable convolutions when token counts are large and local inductive bias is useful, whereas late stages use vanilla self-attention when token counts are smaller and global reasoning is more useful [2210.13452].

This placement is also part of a broader MetaFormer argument. The same study reports that IdentityFormer, which uses identity mapping as the token mixer, achieves \(>80\%\) accuracy on ImageNet-1K, and RandFormer, which uses a frozen random matrix, achieves \(>81\%\). CAFormer is therefore not presented as an isolated architecture, but as a particularly strong point in a wider design space where the MetaFormer interface permits interchangeable token mixers while retaining competitive performance [2210.13452].

## 2. Architectural specification of the vision backbone

CAFormer adopts a standard 4-stage hierarchical architecture of the kind used by ResNet, PoolFormer, and Swin. Each stage \(i\) has \(L_i\) blocks and feature dimension \(D_i\). Downsampling is implemented by convolutions: the first downsampling uses kernel size \(7\) and stride \(4\), and the remaining three use kernel size \(3\) and stride \(2\). The classifier head is
\[
\text{Global average pooling} \rightarrow \text{Norm} \rightarrow \text{MLP}.
\]
Its defining stage allocation is explicit:
\[
T = (\mathrm{Conv}, \mathrm{Conv}, \mathrm{Attn}, \mathrm{Attn}).
\]
Thus, the first two stages use depthwise separable convolutions and the last two stages use vanilla self-attention [2210.13452].

| Variant | Channels \(C\) | Depths \(L\) |
|---|---:|---:|
| CAFormer-S18 | \((64,128,320,512)\) | \((3,3,9,3)\) |
| CAFormer-S36 | \((64,128,320,512)\) | \((3,12,18,3)\) |
| CAFormer-M36 | \((96,192,384,576)\) | \((3,12,18,3)\) |
| CAFormer-B36 | \((128,256,512,768)\) | \((3,12,18,3)\) |

For the convolutional token mixer, the paper uses the inverted separable convolution from MobileNetV2,
\[
\mathrm{Convolutions}(X)=\mathrm{Conv}_{pw2}\!\left(\mathrm{Conv}_{dw}\!\left(\sigma(\mathrm{Conv}_{pw1}(X))\right)\right),
\]
with kernel size \(7\) and expansion ratio \(2\). The attention stages use vanilla self-attention from the original Transformer as a global token mixer [2210.13452].

A second architectural component tied closely to CAFormer is the activation function StarReLU. The paper first discusses
\[
\mathrm{SquaredReLU}(x)=x\mathrm{ReLU}(x)=(\mathrm{ReLU}(x))^2,
\]
and then defines
\[
\mathrm{StarReLU}(x)=s\cdot (\mathrm{ReLU}(x))^2+b,
\]
where \(s\) and \(b\) are scalar scale and bias terms, shared across channels and optionally learnable. The motivation is computational as well as empirical: GELU is described as about \(14\) FLOPs, while StarReLU uses \(4\) FLOPs, or \(3\) if only one of \(s\) or \(b\) is used, corresponding to about a \(71\%\) reduction in activation FLOPs relative to GELU [2210.13452].

The same study reports that replacing StarReLU in CAFormer-S18 with ReLU reduces top-1 accuracy from \(83.6\%\) to \(82.9\%\), while Squared ReLU and GELU each yield \(83.4\%\). This places StarReLU not merely as a cheaper substitute, but as the default activation actually used in the published CAFormer configurations [2210.13452].

## 3. Supervised training regime, empirical performance, and backbone behavior

The published ImageNet-1K results for CAFormer are obtained under normal supervised training, without external data or distillation. The training setup is unusually explicit: ImageNet-1K at resolution \(224^2\), \(300\) epochs, LAMB optimizer for CAFormer, training batch size \(4096\), and fine-tuning at \(384^2\) for \(30\) epochs with batch size \(1024\) and EMA. Regularization and augmentation include RandAugment, Mixup, CutMix, Random Erasing, weight decay, Label Smoothing, and Stochastic Depth; repeated augmentation, external data, and distillation are not used. The paper notes that CAFormer slightly drops in performance under AdamW with very large batch size and therefore switches to LAMB as a more large-batch-friendly optimizer [2210.13452].

Under that regime, CAFormer-B36 is reported to achieve \(85.5\%\) top-1 accuracy on ImageNet-1K at \(224^2\), described as a new record under normal supervised training without external data or distillation. The paper also states that this surpasses MViTv2-L at \(85.3\%\), with \(55\%\) fewer parameters and \(45\%\) fewer MACs. At \(384^2\), CAFormer-B36 reaches \(86.4\%\) [2210.13452].

Across smaller and medium scales, the reported top-1 accuracies are \(83.6\%\) for CAFormer-S18, \(84.5\%\) for CAFormer-S36, and \(85.2\%\) for CAFormer-M36. The same tables compare these against contemporary backbones: CAFormer-S18 exceeds ConvFormer-S18 (\(83.0\%\)), Swin-T (\(81.3\%\)), ConvNeXt-T (\(82.1\%\)), iFormer-S (\(83.4\%\)), and CoAtNet-0 (\(81.6\%\)); CAFormer-S36 exceeds ConvFormer-S36 (\(84.1\%\)), Swin-S (\(83.0\%\)), ConvNeXt-S (\(83.1\%\)), and CoAtNet-1 (\(83.3\%\)); CAFormer-M36 exceeds ConvFormer-M36 (\(84.5\%\)), Swin-B (\(83.5\%\)), ConvNeXt-B (\(83.8\%\)), MViTv2-B (\(84.4\%\)), CoAtNet-2 (\(84.1\%\)), and iFormer-L (\(84.8\%\)) [2210.13452].

The paper further states that CAFormer compares favorably on throughput and robustness, and that it performs strongly on COCO detection and segmentation as well as ADE20K segmentation. This suggests that its conv-attention stage split functions not merely as an ImageNet classification design choice, but as a general-purpose backbone configuration within the MetaFormer family [2210.13452].

## 4. Interpretability studies and the Grad-CAM failure mode

A later study examined CAFormer in the context of interpretability alignment with human visual strategies using ClickMe heatmaps and Spearman rank correlation as the metric. The evaluated model was CAFormer\_s18 together with a DCLS variant, CAFormer\_s18\_dcls, obtained by drop-in replacing the model’s depthwise separable convolutions with Dilated Convolution with Learnable Spacings (DCLS) layers. CAFormer is a central case in that study because vanilla Grad-CAM is reported to fail on it, producing heatmaps that are essentially random or uninformative [2408.03164].

For standard Grad-CAM, the appendix gives
\[
\alpha_k^c=\frac{1}{Z}\sum_i\sum_j \frac{\partial y^c}{\partial A_{ij}^k},
\]
\[
L^c=\mathrm{ReLU}\!\left(\sum_k \alpha_k^c A^k\right),
\]
where \(y^c\) is the score for target class \(c\), \(A^k\) is the feature map of channel \(k\), \(A_{ij}^k\) is the activation at spatial location \((i,j)\), \(\alpha_k^c\) is the channel importance weight, and \(Z\) is the number of spatial locations. The authors attribute the CAFormer failure mode to the behavior of internal activations, especially StarReLU, whose learned activation dynamics can cause the standard Grad-CAM summation followed by ReLU to suppress useful signals [2408.03164].

To address this, the paper introduces Threshold-Grad-CAM. Its construction is
\[
A^k_{\mathrm{ReLU}}=\mathrm{ReLU}(\alpha_k^c A^k),
\]
\[
S=\sum_k A^k_{\mathrm{ReLU}},
\]
\[
N=\frac{S}{\max(S)},
\]
\[
H=
\begin{cases}
N & \text{if } N\ge t\\
0 & \text{otherwise}
\end{cases}
\qquad\text{with } t=0.3.
\]
This amounts to applying ReLU before summation rather than after, normalizing, and thresholding weak activations [2408.03164].

The quantitative shift for CAFormer is substantial. CAFormer\_s18 has Top-1 accuracy \(83.66\), Grad-CAM score \(0.1719\), and Threshold-Grad-CAM score \(0.5571\). CAFormer\_s18\_dcls has Top-1 accuracy \(83.56\), Grad-CAM score \(-0.0594\), and Threshold-Grad-CAM score \(0.6011\). On this evidence, the study concludes that vanilla Grad-CAM suggests failure, Threshold-Grad-CAM reveals a meaningful alignment, and DCLS improves CAFormer’s Threshold-Grad-CAM alignment from \(0.5571\) to \(0.6011\) [2408.03164].

The broader significance is methodological. Low interpretability scores for CAFormer under vanilla Grad-CAM need not indicate that the model itself is poorly aligned with human attention; they may instead indicate that the explanation method is mismatched to the architecture. In that sense, CAFormer functions in the DCLS study as a stress test for explanation pipelines rather than simply as another backbone in a benchmark table [2408.03164].

## 5. Relation to later MetaFormer-style work

Subsequent MetaFormer-style research has used CAFormer as a reference architecture for probing which parts of the design are essential. “Activation-Free Backbones for Image Recognition: Polynomial Alternatives within MetaFormer-Style Vision Models” replaces standard pointwise activations and softmax exponentials with Hadamard-product polynomial modules, while retaining the same modular backbone logic. Its APolyNeXt variant is the closest polynomial analogue to CAFormer because it uses PolyConv in stages 1–2 and PolyAttn in stages 3–4, mirroring CAFormer’s hybrid conv-attention structure [2605.20839].

The polynomial replacements are defined explicitly. PolyMLP is
\[
\text{PolyMLP}(\mathbf{x})=\mathbf{W}_o\!\left((\mathbf{W}_a\mathbf{x})*(\mathbf{W}_b\mathbf{x})\right),
\]
PolyConv uses a pointwise-conv to depthwise-conv to pointwise-conv structure with multiplicative fusion of a coarse dilated branch and a fine \(3\times3\) branch,
\[
\mathbf{h}=\mathbf{W}_{\text{in}}\mathbf{x},
\qquad
\mathbf{m}=K_c(\mathbf{h}) * \mathrm{flip}(K_f(\mathbf{h})),
\qquad
\mathbf{y}=\mathbf{W}_{\text{out}}\big(K(\mathbf{m})\big),
\]
and PolyAttn replaces softmax attention with
\[
\mathbf{A}=(s\cdot \mathbf{Q}\mathbf{K}^\top + 1)^p
\]
followed by \(\ell_1\) row normalization, with \(p=4\) [2605.20839].

The empirical comparisons are framed directly against MetaFormer baselines including CAFormer. On ImageNet-1K, APolyNeXt-L matches CAFormer-M36 at \(85.2\%\), and APolyNeXt-S exceeds CAFormer-S18, \(84.3\%\) versus \(83.6\%\). On ADE20K semantic segmentation with UperNet under the ConvNeXt recipe, CAFormer-S18 records \(48.9\) mIoU, while CPolyNeXt-S reaches \(50.6\) mIoU and APolyNeXt-S reaches \(49.9\) mIoU [2605.20839].

These comparisons are informative because they isolate a design question that CAFormer had left open: whether the strength of a MetaFormer hybrid is fundamentally tied to GELU/ReLU/softmax-style nonlinearities. The polynomial study argues that the principal difficulty is optimization and stability rather than representational power, and addresses it with Sigmoid-Scale residuals,
\[
\mathbf{y}=\mathbf{x}+\sigma(\lambda)f(\mathbf{x}),
\]
multi-input skip connections, and a preference for deeper and narrower models [2605.20839]. A plausible implication is that CAFormer’s enduring influence lies less in any single primitive than in its stage-wise allocation of local and global mixers inside the MetaFormer scaffold.

## 6. Reuse of the name in auctions and time-series modeling

Outside computer vision, “CAFormer” has been reused for an unrelated transformer-based neural architecture for combinatorial auctions. In “Advancing Differentiable Economics: A Neural Network Framework for Revenue-Maximizing Combinatorial Auction Mechanisms,” CAFormer is the paper’s transformer-style mechanism network for learning approximately incentive-compatible randomized mechanisms under combinatorial feasibility constraints. The input is a bid matrix \(\mathbf{b}\in\mathbb{R}^{n\times k}\), where rows are bidders and columns are bundles. The architecture combines exchangeable layers with stacked attention layers over item-wise, bundle-wise, and agent-wise views; the allocation matrix is constructed so that feasibility is enforced by design through a decomposition into item-to-bundle and bundle-to-agent components. Training follows a regret-penalized revenue objective, and the paper reports that CAFormer achieves negligible regret, typically around \(0.001\) to \(0.004\), while outperforming heuristic baselines in revenue; for example, it reaches revenue \(4.403\) in the symmetric \(2\times2\) case versus CANet’s \(4.285\), and \(11.534\) in the symmetric \(2\times5\) case versus CANet’s \(11.393\) [2501.19219].

The same auction architecture is then applied to cyber defense planning in “Strategic Cyber Defense via Reinforcement Learning-Guided Combinatorial Auctions.” There, CAFormer consumes host-specific valuations over bundles of defensive actions such as Analyze, Remove, and Restore, with valuations derived from reinforcement-learning Q-values. The mechanism outputs an allocation of action bundles to hosts and a payment vector, and is trained with a combined revenue-and-regret loss. In the DARPA CAGE Challenge 2 Scenario 2 setting, the paper reports that regret approaches zero after about \(10{,}000\) iterations, that truthful allocations concentrate on Remove and \(\{\text{Analyze},\text{Remove}\}\), and that aggregate allocation scores correlate strongly with Blue activity, with Pearson \(r=0.964\) and \(p=0.0361\) [2509.10983].

A further homograph appears in time-series analysis as “Caformer,” short for causal Transformer. This model is unrelated to the MetaFormer backbone and instead comprises a Dependency Learner, Dynamic Learner, and Environment Learner. Its causal graph is
\[
X \to T \to D,\qquad T \leftarrow C \rightarrow D,
\]
and it uses back-door adjustment,
\[
\mathcal{P}(D \mid do(T)) = \sum_i \mathcal{P}(D \mid T, c_i)\mathcal{P}(c_i),
\]
to mitigate spurious correlation induced by environmental factors. It is evaluated on long- and short-term forecasting, imputation, classification, and anomaly detection, with reported best average accuracy \(77.1\%\) on 10 UEA classification datasets and best average F1-score \(86.77\) on five anomaly-detection datasets [2403.08572].

Taken together, these usages make “CAFormer” a polysemous research term. In vision it denotes a specific conv-attention MetaFormer backbone; in automated mechanism design it denotes a transformer-based auction mechanism; and in time-series analysis the near-homograph “Caformer” denotes a causal sequence model. For technical discourse, domain qualification is therefore essential.

Source: https://www.emergentmind.com/topics/caformer