Abstract
Visual Reasoning (VR) requires complex multi-step logic to interpret visual scenes and answer nuanced queries. Existing methods typically rely on monolithic "black-box" models or static compositional pipelines that lack feedback mechanisms. We present HYDRA (HYper agent for Dynamic compositional visual ReAsoning), a multi-stage framework that introduces a Reinforcement Learning (RL) agent as a cognitive controller. By evaluating and selecting from multiple instruction samples generated by an LLM planner, HYDRA enables dynamic, incremental reasoning with a verifiable feedback loop. Our experiments across benchmarks like OK-VQA and GQA demonstrate that HYDRA achieves state-of-the-art performance by effectively filtering illogical plans and maintaining context through a state memory bank.
Introduction
Visual Reasoning (VR) is a cornerstone of advanced AI, tasking systems with answering complex queries about images, such as "Is the person to the right of the cup wearing jeans?" Current solutions typically follow two paradigms: monolithic Vision-Language Models (VLMs) and compositional models. While VLMs like LLaVA are powerful, they are often opaque and struggle with explicit multi-step logic. Conversely, compositional models like ViperGPT use LLMs to generate programs for vision tools but are often "one-shot" and brittle; a single failure in the plan or a tool leads to total failure. HYDRA addresses this by introducing a feedback loop and a verifiable controller to evaluate reasoning steps dynamically.
The HYDRA Architecture
HYDRA's architecture is built around four primary components that facilitate an incremental reasoning loop:
- The Planner (LLM): Instead of generating a single, potentially flawed plan, the LLM generates a distribution of multiple "instruction samples." These samples vary in complexity and depth, providing the system with multiple potential paths to a solution.
- The Controller (RL Agent): This is the central innovation of HYDRA. Using a Deep Q-Network (DQN), the RL agent acts as a "meta-controller." It evaluates the instructions proposed by the planner and can either reject them—forcing the planner to try again—or select the most promising one for execution. This filtering mechanism significantly reduces errors caused by LLM hallucinations.
- The Reasoner: Once an instruction is selected, the Reasoner converts it into executable Python code. It leverages specialized Visual Foundation Models (VFMs) like GLIP for object grounding or BLIP-2 for image captioning to interact with the visual data.
- Textualizer and State Memory Bank: To handle multi-step reasoning, visual outputs from the Reasoner are converted back into text by a Textualizer. These intermediate results are stored in a State Memory Bank, which provides the Planner with the necessary context for subsequent reasoning steps.
Comparative Analysis
HYDRA's design distinguishes it from previous compositional models by including an explicit Controller and an Internal Representation (IR) feedback mechanism. As shown in the comparison table below, while models like Chameleon and IdealGPT utilize LLMs for planning and reasoning, they lack the RL-driven control and iterative memory management that define HYDRA.
Experimental Results
The framework was rigorously tested on OK-VQA, GQA, RefCOCO/RefCOCO+, and A-OKVQA.
- OK-VQA: HYDRA achieved 48.6% accuracy, a significant improvement over ViperGPT's 40.7% and even larger end-to-end models like InstructBLIP.
- GQA: It reached 47.9%, outperforming IdealGPT (41.7%).
- Visual Grounding: On RefCOCO, it achieved a 61.7% IoU, demonstrating precise spatial reasoning.
Ablation studies confirmed that the RL agent alone contributes an average of 4.71% to accuracy, validating its role as a critical "meta-controller" that prevents the system from following flawed reasoning paths.
Conclusion
HYDRA represents a shift toward more robust, human-like cognitive persistence in visual reasoning. By moving away from brittle, one-shot planning to a dynamic, RL-controlled loop, it achieves superior performance and generalization. Future work will focus on refining the RL agent's control over code generation to preemptively catch errors before execution, further closing the gap between machine perception and complex logical reasoning.
Summary updated