# CIAR: Collaborative Interval-based AutoRegressive Decoding for Efficient Image Generation

CIAR is a novel cloud-device collaborative framework that accelerates autoregressive image generation through interval-based uncertainty quantification. The core innovation includes:

1. **Inter-Head Module**: Generates probability intervals for each token
3. **CLoud-enhanced Decoding**: Maintains distributional consistency
4. **Inter-DRO Loss**: Aligns device and cloud outputs

## Repository Structure

```bash
.
├── configs/ # Model configuration files
│ ├── base.yaml
│ └── train_inter.yaml
├── data/
│ └── prompts/ # Training/testing prompt datasets
│ ├── train_prompts.json
│ └── test_prompts.json
├── entrypoints/ # Main execution file
│ ├── generate_images_ciar.py # CIAR inference pipeline
│ ├── inter_utils.py # Uncertainty quantification
│ ├── train_inter/ # Inter-Head training
│ │ └── train_inter_head.py
│ └── models/
│ ├── drafters/
│ │ └── inter_cnets_llamagen.py # Inter-Head architecture
│ └── ea_model_llamagen.py # CIAR main model
├── requirements.txt # Python dependencies
└── README.md # This document
```

## Quick Start
1. Install dependencies:

```bash
pip install -r requirements.txt
```

2. Run CIAR generation:

```bash
CUDA_VISIBLE_DEVICES=0 python -m entrypoints.generate_images_ciar \
--model llamagen \
--model_type eagle \
--model_path path/to/main_model \
--drafter_path path/to/inter_head_model \
--output_dir results/ \
--prompt MSCOCO2017Val \
--slice 0-1000 \
--num_images 1000
```

