TL;DR
EndoCoT introduces an "Endogenous Chain-of-Thought" framework that enables diffusion models to perform deep, step-by-step visual reasoning. By iteratively refining latent thought states within a Multimodal Large Language Model (MLLM) and bridging them dynamically to a Diffusion Transformer (DiT), it achieves state-of-the-art performance on complex combinatorial and spatial tasks like Sudoku and maze-solving.
What Problem Does This Paper Address?
While diffusion models excel at generating photorealistic images, they struggle with tasks requiring strict sequential logic and spatial planning—such as tracing a path through a maze or solving a Sudoku puzzle.
The authors identify a fundamental flaw in how current frameworks integrate Multimodal Large Language Models (MLLMs). Typically, MLLMs act as static text encoders: they compute a text embedding once at the very beginning, and this guidance remains invariant throughout the entire visual generation process. This paradigm suffers from two major limitations:
- Insufficient Reasoning Depth: A single forward pass through an MLLM text encoder cannot activate the multi-step, iterative reasoning (Chain-of-Thought) required for complex tasks.
- Static-Guidance Failure: Because the conditioning signal never changes, the Diffusion Transformer (DiT) cannot progressively decompose complex instructions into actionable denoising steps, leading to a total collapse in spatial grounding when faced with dense topologies.
Methods
To overcome these bottlenecks, the authors propose EndoCoT (Endogenous Chain-of-Thought), which seamlessly integrates reasoning and generation through three core components:
- Iterative Thought Guidance: Instead of a single encoding step, EndoCoT recursively updates continuous latent thought states within the MLLM over multiple reasoning rounds ($\mathcal{T}$). The hidden state from the previous round serves as a direct, high-dimensional input to the next round, bypassing discrete text lookups. Each updated thought state then guides a complete DiT denoising trajectory.
- Terminal Thought Grounding: To prevent the continuous latent states from drifting into semantically meaningless spaces, the authors introduce an auxiliary alignment loss ($\mathcal{L}_{\text{align}}$). This aligns the MLLM's final latent reasoning state with the explicit textual embeddings of the ground-truth solution steps.
- Progressive Two-Stage Training: Directly optimizing intermediate reasoning and final visual quality simultaneously can cause conflicting gradients. EndoCoT uses a two-stage strategy: Stage 1 focuses on developing step-by-step visual reasoning across all intermediate steps, while Stage 2 (Terminal Consolidation) freezes intermediate gradients and optimizes solely for the final output to maximize visual accuracy.
Datasets
The model was evaluated on a comprehensive suite of visual reasoning benchmarks totaling 182.4K instances:
- Maze Navigation (75K): Finding paths in perfectly connected grids.
- Sudoku Solving (40K): Progressively filling empty cells on a 9x9 board.
- Traveling Salesperson Problem (30K): Planning the shortest closed loop connecting random cities.
- Visual Spatial Planning (37.4K): Graph-search hazard avoidance tasks based on FrozenLake, scaled up to complex 32x32 maps (VSP-Super).
Additionally, the authors curated a high-quality multi-step image editing dataset containing 10,000 unique scenes and 30,000 images to test progressive visual transformations.
Key Insights and Ideas
- Where the Heavy Lifting Happens: Layer-wise sensitivity analysis revealed that peak reasoning sensitivity is highly concentrated at the architectural junction between the terminal layers of the LLM and the initial layers of the DiT. This proves that joint fine-tuning of both components is essential to unlock visual reasoning.
- Implicit vs. Explicit Tokens: One might assume that forcing the model to output explicit text reasoning steps would be better. However, the authors found that explicit tokens cause severe performance degradation on long-horizon tasks due to autoregressive error accumulation and mode collapse. Continuous, implicit latent tokens offer the flexibility needed for robust planning.
- A True Inference Scaling Law: EndoCoT exhibits a clear compute-to-accuracy trade-off at inference time. Dynamically increasing the number of implicit reasoning steps ($\mathcal{T}$) smoothly and predictably elevates both accuracy and path correctness, particularly on the hardest benchmarks.
Key Results
EndoCoT establishes a new state-of-the-art across all evaluated tasks, achieving an average accuracy of 92.1% under task-specific training, outperforming the strongest baseline (DiffThinker) by 8.3 percentage points.
The performance gap widens dramatically as task complexity scales:
- On Maze-32, EndoCoT achieves 90% accuracy, while DiffThinker drops to 65%.
- On Sudoku-35, EndoCoT reaches 95% accuracy, outperforming the baseline by a massive 40 percentage points.
- Out-of-Distribution Generalization: Unlike prior models that rely on fragile pattern matching, EndoCoT successfully generalizes to novel domains, such as unseen maze sizes and completely new Sudoku font styles.
Limitations and Future Work
Despite its strong performance, the authors note a few limitations:
- Manual Tuning: The optimal number of reasoning steps ($\mathcal{T}$) must currently be set manually during inference.
- Supervision Dependency: The framework relies heavily on high-quality datasets that contain explicit, step-by-step intermediate supervision.
Future Directions: The team aims to develop adaptive mechanisms that allow the model to automatically control its own reasoning depth based on task difficulty, and to extend EndoCoT to broader, general-purpose multimodal tasks.
Summary updated