[ECCV 2026] DARL: Efficient Document-to-Markup Generation via Look-Ahead Diffusion Trajectory Sampling
Official PyTorch implementation of DARL from the ECCV 2026 paper.
DARL is a hybrid diffusion-autoregressive framework that achieves 2.3× inference speedup on document parsing tasks while maintaining state-of-the-art accuracy. The method introduces:
- Online Monte Carlo Trajectory Generation (OMTG): Real-time trajectory sampling with sliding window mechanism
- Diffusion Trajectory Preference Optimization (DTPO): Reinforcement learning with longest common prefix (LCP) rewards for improved convergence
- 2.3× Speedup: Accelerates document parsing inference through parallel token generation
- Plug-and-Play: Compatible with various VLLM backbones (Qwen, InternVL, dots.ocr, etc.)
- High Accuracy: Maintains comparable or better accuracy than autoregressive baselines
- Scalable: Better performance with larger models (up to 2.78× speedup on 14B models)
First, install the base model dots.ocr.
Then install the required dependencies:
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu121- Python 3.8+
- CUDA 12.1+
- Multi-GPU setup recommended (tested on 8× A100)
- Flash Attention 2.x
git clone https://github.com/your-repo/DARL.git
cd DARL
pip install -r requirements.txtOrganize your document datasets in the following structure:
data/
├── magazine/
│ ├── magazine.json
│ └── images/
├── newspaper/
│ ├── newspaper.json
│ └── images/
└── ...
Each JSON file should contain entries like:
{
"prompt": "Recognize image as Markdown format",
"text": "Ground truth transcription...",
"img": "images/sample_001.jpg"
}Launch training with DeepSpeed ZeRO-2:
accelerate launch --config_file configs/deep_config.yaml train.pyModify training parameters in train.py:
max_new_tokens: Sliding window sizelearning_rate: Learning rateweight_ar: DAR loss weightweight_rl: DTPO loss weight
Run inference and evaluation on document parsing benchmarks:
python eval.pyThe evaluation script supports:
- OmniDocBench-1.5 benchmark
- olmOCR-Bench benchmark
- Automatic result saving and time tracking
- Batch processing with GPU acceleration
Results will be saved to results/ directory with individual outputs and summary statistics.
DARL combines:
- Diffusion-based Parallel Generation: Generates multiple tokens simultaneously using special initialization tokens
- Sliding Window Verification: Verifies generated tokens incrementally from left to right
- Hybrid AR-NAR Training: Combines autoregressive and non-autoregressive objectives
- Trajectory Generator (
src/trajectory_generator.py): Implements OMTG for diverse trajectory sampling - Reward Calculator (
src/reward_calculator.py): Computes LCP and verification rewards for DTPO - DARL Trainer (
src/dar_trainer.py): Main training loop combining supervised and RL losses
Pre-trained DARL models are available on Hugging Face:
🤗 Model Hub: https://huggingface.co/Geong/DARL
Download and use:
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(
"your-org/DARL-weights",
trust_remote_code=True
)If you find DARL useful in your research, please cite:
@inproceedings{darl2026,
title={DARL: Efficient Document-to-Markup Generation via Look-Ahead Diffusion Trajectory Sampling},
author={Yang, Wentao and Shi, Yongxin and Tang, Rui and Zhang, Peirong and Wu, Shihang and He, Huiguo and Huang, Zheng and Peng, Dezhi and Liao, Minghui and Jin, Lianwen},
booktitle={European Conference on Computer Vision (ECCV)},
year={2026}
}This research is built on top of:
- dots.ocr: Base document parsing model
- Qwen-VL: Vision-language foundation
- DeepSpeed: Distributed training framework
This project is licensed under the Apache 2.0 License.
For questions and feedback, please contact: wente_young@foxmail.com