Learning 1D Causal Visual Representation with De-focus Attention Networks

Chenxin Tao, Xizhou Zhu, Shiqian Su, Lewei Lu, Changyao Tian, Xuan Luo, Gao Huang, Hongsheng Li, Yu Qiao, Jie Zhou, Jifeng Dai

Abstract

Large Language Models (LLMs) have demonstrated the power of 1D causal sequence modeling for natural language. However, applying this architecture to computer vision has historically resulted in a performance gap compared to 2D non-causal Vision Transformers (ViTs). This paper introduces De-focus Attention Networks, a framework designed to bridge this gap. By identifying and mitigating the "over-focus" issue—where attention collapses onto a small subset of tokens in deep layers—the proposed method enables 1D causal models to achieve competitive performance on standard vision benchmarks. Through the use of learnable bandpass filters and aggressive optimization strategies, we demonstrate that 1D causal models can match or exceed the performance of their 2D counterparts in classification, detection, and multi-modal tasks.

1. Introduction

In contemporary AI research, a fundamental architectural divide exists between modalities. Text processing is dominated by 1D causal models, which process information sequentially. Conversely, vision tasks are typically handled by 2D non-causal models that allow every pixel to attend to every other pixel. This "modality gap" complicates the development of unified architectures.

When images are flattened into 1D sequences (e.g., via a row-by-row z-scan), standard causal models suffer from an "over-focus" phenomenon. In the deeper layers of these models, the attention mechanism tends to collapse, concentrating on a tiny fraction of visual tokens. This leads to sparse gradient maps and a lack of global image understanding, preventing 1D causal models from reaching the accuracy levels of standard ViTs.

2. De-focus Attention Networks

To address the over-focus issue, we propose De-focus Attention Networks, which utilize two primary mechanisms to ensure the model maintains a broad, global perspective.

2.1 Learnable Bandpass Filters

We integrate learnable exponential spatial decay with relative position embeddings (such as RoPE). This combination acts as a "bandpass filter" in the frequency domain. By allowing different attention heads to focus on different spatial frequencies, the network ensures that even if specific heads focus on local details, others are forced to capture broader, diverse information across the sequence. This prevents the total collapse of attention diversity.

2.2 Enhanced Optimization Strategies

Beyond architectural changes, we implement two critical training strategies:

  • Large Scheduled Drop Path: We employ a high drop path rate (up to 0.7) that increases throughout the training process. This forces individual layers to learn robust representations and prevents the model from relying solely on depth to expand its receptive field.
  • Auxiliary Global Loss: Traditional vision models often rely on a single classification token. We introduce an auxiliary loss based on the average of all image tokens. This ensures that every token in the sequence receives a meaningful gradient signal, promoting a more holistic representation of the visual input.

3. Experimental Evaluation

We evaluated the De-focus strategy across several architectures, including Transformers, Mamba (State Space Models), and RetNet.

3.1 Image Classification

On ImageNet-1K, the De-focus Mamba-Base model achieved a Top-1 accuracy of 82.0%. This outperforms the 2D non-causal DeiT-Base (81.8%) and represents a significant improvement over the standard 1D Mamba baseline (80.5%).

3.2 Object Detection and Segmentation

Using the DINO framework on the MS-COCO dataset, De-focus Mamba reached 53.2 AP, surpassing the DeiT-Base baseline of 52.3 AP. This demonstrates that the 1D causal representation is sufficiently rich for dense prediction tasks.

3.3 Multi-modal Performance

When integrated into a CLIP-style training objective on the Laion-400M dataset, the model achieved 62.7% zero-shot accuracy on ImageNet. This performance matches standard non-causal CLIP models, proving the viability of 1D causal encoders for multi-modal alignment.

4. Discussion and Insights

The primary contribution of this work is the discovery that the 2D spatial inductive bias is not strictly necessary for high-performance vision models. By visualizing gradient maps, we observed that "de-focusing" the attention mechanism transforms sparse, end-of-sequence gradients into dense, global maps. This suggests that 1D sequence modeling is a sufficient foundation for vision, provided the optimization and attention dynamics are correctly managed.

5. Conclusion and Future Work

De-focus Attention Networks successfully bridge the performance gap between 1D causal and 2D non-causal vision models. While the current "recipe" requires careful tuning of drop path rates and auxiliary losses, it opens the door for truly unified vision-language architectures. Future research will explore more sophisticated 1D scanning paths and the potential for these de-focused representations to improve auto-regressive image generation, potentially leading to unified models capable of both high-fidelity perception and creation.

Summary updated

BibTeX
@inproceedings{tao2024learning,
  author = {Chenxin Tao and Xizhou Zhu and Shiqian Su and Lewei Lu and Changyao Tian and Xuan Luo and Gao Huang and Hongsheng Li and Yu Qiao and Jie Zhou and Jifeng Dai},
  title = {{Learning 1D Causal Visual Representation with De-focus Attention Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=LxRmdXf72k},
}
Figure