Skip to content

title: >- [Paper Note] When W4A4 Breaks Camouflaged Object Detection: Token-Group Dual-Constraint Activation Quantization description: >- [ECCV 2026][segmentation][camouflaged_object_detection] Addressing the severe accuracy cliff of Transformer-based camouflaged object detection under post-training W4A4 quantization caused by heavy-tailed background tokens inflating clipping ranges and zeroing weak boundary cues, COD-TDQ introduces Direct-Sum Token-Group (DSTG) scaling and Dual-Constraint Range Projection (DCRP) to preserve subtle boundary activations without retraining. tags: - ECCV 2026 - segmentation - model_compression - camouflaged_object_detection - post_training_quantization date: 2026-09-19 content_hash: e0fb99ad77ad1a1b

When W4A4 Breaks Camouflaged Object Detection: Token-Group Dual-Constraint Activation Quantization

Conference: ECCV 2026
Paper: ECCV Official Link
Code: https://github.com/MCG-NKU/nku-model-compre
Area: Segmentation / Model Compression
Keywords: Camouflaged Object Detection, Post-Training Quantization, W4A4 Quantization, Token-Group Quantization, Dual-Constraint Projection

TL;DR

To fix the catastrophic failure of Transformer-based camouflaged object detection under post-training W4A4 quantization—where heavy-tailed background tokens inflate shared clipping ranges and push subtle boundary cues into the zero bin—COD-TDQ couples Direct-Sum Token-Group scaling (DSTG) with Dual-Constraint Range Projection (DCRP) to restore accuracy and enable a 1.50x real inference speedup without retraining.

Background & Motivation

Camouflaged object detection (COD) aims to segment objects that visually blend into their surroundings, forcing neural networks to rely on subtle, low-amplitude yet spatially coherent boundary and texture cues. With the recent dominance of Vision Transformer backbones (e.g., Swin Transformer, PVT) and multi-stage decoders, modern COD models deliver remarkable segmentation accuracy. However, this architectural sophistication brings severe computational costs and memory burdens, which impede real-time deployment on mobile and resource-constrained edge platforms. Post-training quantization (PTQ) offers an appealing avenue for compression without costly retraining, but conventional INT8 quantization provides diminishing returns under extreme budgets, necessitating exploration into ultra-low-bit W4A4 (4-bit weights and 4-bit activations) regimes. Unexpectedly, while conventional vision models degrade gracefully, Transformer-based COD suffers an acute, catastrophic performance collapse under naive W4A4.

The core tension stems from a fundamental conflict: camouflaged scene signals inherently exhibit low contrast with weak feature amplitudes, whereas the vast majority of background tokens generate heavy-tailed activation distributions featuring severe extreme outliers. Standard tensor-wise or layer-wise quantizers force all tokens to share a single clipping radius \(c\). Consequently, a handful of heavy-tailed background spikes dictate the global dynamic range, inflating the quantization step size \(\Delta\). Under standard rounding-to-nearest operations, the faint, structured activations along object contours fall beneath the threshold \(|x| \le \Delta / 2\) and are mercilessly mapped into the zero bin. Once these minority boundary responses are rounded to zero, downstream self-attention mixing and projection layers cannot recover the missing signed structural evidence, causing extensive mask fragmentation or total segmentation failure.

Diagnostic experiments reveal that this failure is strictly activation-dominated: naive W4A8 maintains performance on par with FP32, whereas naive W4A4 triggers complete breakdown. The paper's angle of attack is to break cross-token scale coupling and enforce explicit mathematical constraints on quantization step coarseness and zero-bin mass. Core idea: introduce COD-TDQ, which integrates Direct-Sum Token-Group (DSTG) scaling to decouple background outliers from weak foreground tokens, and Dual-Constraint Range Projection (DCRP) to mathematically cap both the step-to-dispersion ratio and the zero-bin mass.

Method

Overall Architecture

COD-TDQ operates as a training-free, hardware-agnostic post-training quantization pipeline. Weights are statically quantized using standard per-channel symmetric uniform 4-bit quantization. The key novelty lies in dynamic activation quantization across Linear and Conv operators: each input activation tensor is partitioned into compact token groups via Direct-Sum Token-Group (DSTG) decomposition to eliminate cross-token interference, after which Dual-Constraint Range Projection (DCRP) projects the local clipping radius into an analytically bounded feasible region controlling step coarseness and zeroization. The bounded activations are then uniformly quantized to signed 4-bit integers.

%%{init: {'flowchart': {'rankSpacing': 24, 'nodeSpacing': 28, 'padding': 6, 'wrappingWidth': 400}}}%%
flowchart TD
    A["Input Activation Tensor X"] --> B["Direct-Sum Token-Group (DSTG)<br/>Decouple cross-token range interference"]
    B --> C["Dual-Constraint Range Projection (DCRP)<br/>Joint projection on step ratio & zero-bin mass"]
    C --> D["Uniform 4-bit Quantization & Dequantization<br/>Preserve subtle boundary activations"]
    D --> E["INT4 GEMM / Downstream Layers"]

Key Designs

1. Direct-Sum Token-Group: Decoupling Cross-Token Range Domination

To prevent heavy-tailed background tokens from artificially dilating the shared dynamic range and coarsening the resolution for weak foreground tokens, DSTG localizes scale allocation to fine-grained token-channel sub-blocks. For any token vector \(x \in \mathbb{R}^C\), channels are split into contiguous groups of size \(g\) (default \(g=32\), with zero-padding to \(C_{\text{pad}} = g \lceil C/g \rceil\) if needed), representing the token as a direct sum of group vectors:

\[x = \bigoplus_{k=1}^K x_k, \quad x_k \in \mathbb{R}^g, \quad K = \frac{C_{\text{pad}}}{g}\]

For each token group \(x_k\), DSTG derives an autonomous base clip radius \(c_k^{\text{base}} = \|x_k\|_\infty\) from its own element magnitudes. In this manner, rare extreme background spikes are confined strictly to their own localized groups, ensuring that the vast majority of tokens carrying weak boundary textures maintain tight, compact step sizes without suffering cross-token range domination where \(c^{\text{global}} \gg c_k^{\text{base}}\).

2. Dual-Constraint Range Projection: Bounding Step-to-Dispersion and Zero-Bin Mass

While DSTG isolates distinct tokens, individual token groups can still exhibit localized heavy tails that inflate their own internal step size and induce zero-bin collapse. DCRP formulates two explicit physical constraints to guarantee representation stability. Constraint C1 bounds the step-to-dispersion ratio \(\eta_k = \Delta_k / \sigma_k \le \tau\) (where \(\sigma_k = \text{Std}(x_k) + \varepsilon\)), deriving an upper bound on the group clipping radius: \(c_k^{(\tau)} = q_{\max} \tau \sigma_k\). Constraint C2 limits the fraction of elements quantizing to zero \(\rho_{0,k} \le \mathrm{zr}\); because zeroization under rounding-to-nearest occurs when \(|x_{k,i}| \le \Delta_k / 2\), capping \(\rho_{0,k} \le \mathrm{zr}\) requires \(\Delta_k / 2 \le Q_{\mathrm{zr}}(|x_k|)\), where \(Q_{\mathrm{zr}}(|x_k|)\) is the empirical \(\mathrm{zr}\)-quantile of absolute values within the group, yielding the radius bound \(c_k^{(\mathrm{zr})} = 2 q_{\max} Q_{\mathrm{zr}}(|x_k|)\).

The final effective clipping radius is obtained by projecting the base radius onto the feasible interval:

\[c_k = \Pi_{\mathcal{C}_k}(c_k^{\text{base}}) = \min\big(c_k^{\text{base}}, c_k^{(\tau)}, c_k^{(\mathrm{zr})}\big)\]

This projection guarantees that the quantization resolution remains tight relative to local feature dispersion while strictly bounding the zeroed activation mass under \(\mathrm{zr}\), safeguarding low-amplitude boundary cues from vanishing.

3. Efficient and Hardware-Friendly Execution

DSTG and DCRP are structured for high hardware parallelism: the group size \(g=32\) aligns cleanly with GPU memory coalescing, and empirical quantile calculation and projection execute directly in on-chip registers without expensive sorting passes. Deployed with custom Triton INT4 GEMM kernels on modern GPUs, COD-TDQ avoids the control branching and latency penalties of dynamic bit-width methods, incurring only a negligible 0.341% memory overhead for scaling and indexing metadata.

Loss & Training

COD-TDQ is a purely post-training quantization method and requires zero retraining or gradient updates. For baseline approaches that rely on offline reconstruction or calibration, a standard 128-image calibration set is utilized. COD-TDQ employs a unified, fixed hyperparameter configuration across all models and datasets: group size \(g=32\), step-to-dispersion threshold \(\tau=1.0\), and zero-bin mass bound \(\mathrm{zr}=0.2\), requiring no per-dataset heuristic tuning.

Key Experimental Results

Main Results

Evaluated on four challenging COD benchmarks (CAMO, CHAMELEON, COD10K, NC4K) using the representative Swin-based CFRN backbone, COD-TDQ is compared against full precision (FP32), naive quantization, and state-of-the-art vision PTQ methods. The table below reports key results on NC4K and CAMO (extracted from Table 2 of the original paper):

Dataset Method \(S_\alpha \uparrow\) \(F_\beta^\omega \uparrow\) \(E_m \uparrow\) \(F_\beta^m \uparrow\) \(\text{MAE} \downarrow\)
NC4K FP32 (Full Precision) .888 .850 .941 .880 .030
NC4K Naive W8A8 .887 .850 .940 .879 .030
NC4K Naive W4A8 .882 .841 .936 .872 .032
NC4K Naive W4A4 .443 .089 .344 .348 .151
NC4K PTQ4ViT .456 .081 .340 .355 .153
NC4K SmoothQuant .452 .108 .543 .342 .157
NC4K PTQ4SAM .702 .632 .761 .660 .082
NC4K IGQ-ViT .710 .651 .776 .688 .080
NC4K RepQ-ViT .718 .651 .783 .691 .072
NC4K Ours (COD-TDQ) .837 .747 .884 .817 .052
CAMO FP32 (Full Precision) .876 .844 .934 .877 .042
CAMO Naive W4A4 .418 .061 .314 .332 .182
CAMO RepQ-ViT .676 .608 .750 .656 .099
CAMO Ours (COD-TDQ) .813 .724 .864 .795 .070

On the PVT-based ESCNet backbone (Table 3 in the paper), FP32 achieves \(S_\alpha = 0.893\) while Naive W4A4 collapses to \(0.576\). While the strongest existing PTQ method RepQ-ViT reaches \(0.818\), COD-TDQ delivers near-lossless performance with \(S_\alpha = \mathbf{0.881}\), \(F_\beta^\omega = 0.849\), \(E_m = 0.936\), and \(\text{MAE} = 0.031\).

Ablation Study

Ablation studies on NC4K dissect the individual contributions of DSTG and DCRP on both CFRN and ESCNet (extracted from Table 4 of the paper):

Backbone Configuration \(S_\alpha \uparrow\) \(F_\beta^\omega \uparrow\) \(E_m \uparrow\) \(F_\beta^m \uparrow\) \(\text{MAE} \downarrow\) Note
CFRN Naive W4A4 .443 .089 .344 .348 .151 Unoptimized W4A4 baseline
CFRN Per-tensor .407 .093 .513 .185 .209 Tensor-wise dynamic range
CFRN DSTG only .451 .180 .532 .241 .270 Grouping without DCRP bounds
CFRN DCRP only .435 .174 .504 .228 .307 Projection without token grouping
CFRN Full (COD-TDQ) .837 .747 .884 .817 .052 DSTG + DCRP coupled together
ESCNet Naive W4A4 .576 .368 .562 .459 .120 Baseline on PVT
ESCNet DSTG only .617 .416 .579 .488 .106 Grouping only
ESCNet DCRP only .771 .684 .805 .744 .062 DCRP projection only
ESCNet Full (COD-TDQ) .881 .849 .936 .876 .031 Near-lossless recovery

Key Findings

  • Tight Coupling of Both Modules: On CFRN, standalone DSTG yields only \(S_\alpha = 0.451\) and standalone DCRP yields \(0.435\); only when combined do they surge to \(0.837\). Grouping without bounds is still corrupted by local heavy tails, while bounds without grouping rely on globally skewed statistics.
  • Drastic Reduction in Boundary Zeroization: Statistical profiling confirms that naive W4A4 zeroes out 41.6% of boundary activations, whereas COD-TDQ suppresses this fraction to 14.2%, completely eliminating non-boundary groups exceeding the step-to-dispersion bound (dropping from 72.60% to 0.00%).
  • Practical Speedup and Memory Reduction: Real INT4 deployment via Triton on an NVIDIA RTX 4090 (Table 5) boosts CFRN throughput from 29.40 FPS to 44.21 FPS (reducing latency from 34.02 ms to 22.61 ms), slashes peak memory from 1421.31 MB to 834.92 MB, while DSTG introduces only 0.27 FPS (0.6%) runtime overhead.

Highlights & Insights

  • Root-Cause Mechanical Insight: Pinpointing the W4A4 accuracy cliff of camouflaged object detection to the interplay between background activation heavy tails, shared step size inflation, and minority boundary zero-bin collapse (\(\Delta\), \(\eta\), and \(\rho_0\)).
  • Closed-Form Dual Constraints: Rather than relying on heuristic iterative tuning, DCRP inverts the desired diagnostic bounds into exact mathematical limits on clipping radii, yielding clean and deterministic execution.
  • Broad Transferability for Dense Low-Contrast Vision: Highlights that in low-contrast segmentation (medical lesions, defect detection, concealed targets), PTQ failure is dominated by minority boundary zeroization rather than global MSE; token-group dual-constraint projection provides a generalizable paradigm.

Limitations & Future Work

  • Operator Precision Scope: LayerNorm and Softmax layers are currently retained in FP16; achieving fully quantized INT4 across all operators will require additional numerical stabilization.
  • Fixed Global Hyperparameters: The hyperparameters (\(g=32\), \(\tau=1.0\), \(\mathrm{zr}=0.2\)) are statically applied across all layers; hierarchical adaptation according to layer depth and feature abstraction could further boost fine-grained segmentation.
  • Testing on Giant Vision Backbones: Evaluated primarily on Swin-CFRN and PVT-ESCNet; scaling verification to massive generalist vision foundation models (such as SAM-2) remains an open exploration.
  • vs PTQ4ViT / RepQ-ViT: Standard ViT PTQ methods focus on layer/block output reconstruction and Hessian-guided calibration to optimize average fidelity; COD-TDQ explicitly targets token-wise heterogeneity and low-magnitude boundary preservation, outperforming RepQ-ViT by over 0.11 \(S_\alpha\) on NC4K.
  • vs SmoothQuant: SmoothQuant migrates activation outliers to weights via equivalent scaling, which is effective for W8A8 LLMs but fails to prevent weak activations from falling into the zero bin in ultra-low 4-bit activation spaces.
  • vs post-GELU: post-GELU relies on dynamic bit-width assignment that breaks hardware regular parallelism; COD-TDQ maintains a uniform W4A4 computational grid, preserving extreme efficiency on standard INT4 tensor cores.

Rating

  • Novelty: ⭐⭐⭐⭐☆ Highly insightful diagnosis of the COD-specific quantization cliff and an elegant dual-constraint projection formulation.
  • Experimental Thoroughness: ⭐⭐⭐⭐⭐ Comprehensive coverage across 4 benchmark datasets, 2 distinct Transformer backbones, diagnostic telemetry, thorough ablations, and real Triton INT4 GPU benchmarking.
  • Writing Quality: ⭐⭐⭐⭐⭐ Methodical exposition progressing logically from empirical motivation to theoretical formulation and real-world profiling.
  • Value: ⭐⭐⭐⭐☆ Practical, retraining-free solution enabling real-time edge deployment of high-precision camouflaged object detection.