Method
DARL introduces two components on top of a vision-language backbone:
- Online Monte Carlo Trajectory Generation (OMTG): real-time trajectory sampling with a sliding window mechanism
- Diffusion Trajectory Preference Optimization (DTPO): reinforcement learning with longest common prefix (LCP) rewards
At inference, multiple tokens are generated in parallel via special initialization tokens, then verified incrementally from left to right by the sliding window.
Model Details
Table | |
|---|
| Base model | dots.ocr |
| Architecture | DotsOCRForCausalLM (dots_ocr) |
| Parameters | ~3B (bfloat16) |
| Language model | 28 layers, hidden size 1536, 12 heads (2 KV heads) |
| Vision encoder | dots_vit, 42 layers, patch size 14 |
| Context length | 131072 |
| Precision | bfloat16 |
Usage
Requires trust_remote_code=True since the model ships custom modeling code.
Note: This repo ships the weights, config and tokenizer only. The image preprocessor config is not included — load the processor from the base model dots-studio/dots.ocr as shown below, or copy preprocessor_config.json from there into this repo.
from transformers import AutoModelForCausalLM, AutoProcessor
from PIL import Image
model = AutoModelForCausalLM.from_pretrained(
"your-org/DARL",
trust_remote_code=True,
torch_dtype="bfloat16",
attn_implementation="flash_attention_2",
device_map="cuda",
)
processor = AutoProcessor.from_pretrained("dots-studio/dots.ocr", trust_remote_code=True)
image = Image.open("document.jpg")
prompt = "Recognize image as Markdown format"
messages = [{"role": "user", "content": [
{"type": "image", "image": image},
{"type": "text", "text": prompt},
]}]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=[image], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=4096)
print(processor.batch_decode(outputs[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)[0])
Requirements
- Python 3.8+, CUDA 12.1+
- Flash Attention 2.x
transformers >= 4.51.3
Evaluation
Evaluated on document parsing benchmarks:
- OmniDocBench-1.5
- olmOCR-Bench
Speedup scales with model size, up to 2.78× on 14B backbones. See the paper and repository for full numbers.
Citation
@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}
}
Acknowledgements
Built on top of dots.ocr and Qwen-VL. Supported by the National Natural Science Foundation of China (62476093) and the Natural Science Foundation of Guangdong Province (2026A1515012038).
License
Apache 2.0
wente_young@foxmail.com