Compile Scene Graphs with Reinforcement Learning

Zuyao Chen, Jinlin Wu, Zhen Lei, Marc Pollefeys, Chang Wen Chen

Abstract

Next-token prediction is the fundamental principle for training large language models (LLMs), and reinforcement learning (RL) further enhances their reasoning performance. As an effective way to model language, image, video, and other modalities, the use of LLMs for end-to-end extraction of structured visual representations, such as scene graphs, remains underexplored. It requires the model to accurately produce a set of objects and relationship triplets, rather than generating text token by token. To achieve this, we introduce R1-SGG, a multimodal LLM (M-LLM) initially trained via supervised fine-tuning (SFT) on the scene graph dataset and subsequently refined using reinforcement learning to enhance its ability to generate scene graphs in an end-to-end manner. The SFT follows a conventional prompt-response paradigm, while RL requires the design of effective reward signals. We design a set of graph-centric rewards, including three recall-based variants—Hard Recall, Hard Recall+Relax, and Soft Recall—which evaluate semantic and spatial alignment between predictions and ground truth at the object and relation levels. A format consistency reward further ensures that outputs follow the expected structural schema. Extensive experiments on the VG150 and PSG benchmarks show that R1-SGG substantially reduces failure rates and achieves strong performance in Recall and mean Recall, surpassing traditional SGG models and existing multimodal language models.

Introduction

Scene Graph Generation (SGG) is the task of transforming an image into a structured representation of objects and their semantic relationships (e.g., [person] - [riding] - [horse]). This structured mapping is vital for downstream applications in robotics and complex image understanding. However, traditional SGG models often suffer from "long-tail" biases, over-predicting common relationships like "on" while failing to capture more descriptive ones.

While Multimodal Large Language Models (M-LLMs) offer a promising path for this task, they are primarily optimized for text generation rather than structured data. Standard Supervised Fine-Tuning (SFT) often fails to prevent formatting errors, hallucinations of non-existent objects, or inaccurate spatial coordinates. To address these challenges, we propose R1-SGG, a framework that leverages Reinforcement Learning (RL) to optimize M-LLMs for the actual structure and semantics of scene graphs.

Methodology

The R1-SGG framework employs a two-stage training pipeline:

  1. Supervised Fine-Tuning (SFT): The model is first trained on high-quality image-graph pairs to establish a baseline for vocabulary and structural output.
  2. Reinforcement Learning (RL): Utilizing Group Relative Policy Optimization (GRPO), the model is refined using a "graph-centric" reward system. Unlike SFT, which optimizes token by token, RL allows the model to optimize for the quality of the entire generated graph.
Comparison of SFT and RL training paradigms for Scene Graph Generation.

Reward Design

To provide effective feedback, we designed several reward signals:

  • Format Reward: Ensures the output strictly adheres to the required JSON schema.
  • Graph-Centric Rewards: We evaluated three variants: Hard Recall (exact matches), Hard Recall+Relax (allowing synonyms via word embeddings), and Soft Recall (using bipartite matching). Interestingly, the strict "Hard Recall" signal proved most effective for policy optimization.
  • Spatial Alignment: Rewards are tied to Intersection over Union (IoU) metrics, ensuring predicted bounding boxes accurately reflect the image geometry.

Experimental Results

We evaluated R1-SGG on the VG150 (Visual Genome) and PSG (Panoptic Scene Graph) benchmarks. The results demonstrate a transformative improvement over standard M-LLM approaches.

Performance comparison of R1-SGG against traditional and commercial M-LLMs on the VG150 benchmark.

Key Findings

  • Drastic Error Reduction: On the VG150 dataset, the failure rate for a 7B Qwen2-VL model plummeted from 39.54% with SFT to just 0.08% with R1-SGG. This highlights RL's superior ability to enforce structural constraints.
  • Superior Recall: R1-SGG (7B) achieved a Recall@50 of 19.47% and a mean Recall (mRecall) of 11.43%, outperforming traditional SGG models like MOTIFS and VCTree, as well as commercial models like GPT-4o and Gemini 1.5 Flash.
  • Addressing Long-Tail Bias: The significant boost in mRecall indicates that R1-SGG is far more effective at identifying rare, descriptive relationships than previous methods.

Conclusion

R1-SGG demonstrates that Reinforcement Learning, specifically through graph-centric rewards and GRPO, can successfully bridge the gap between text-based LLMs and structured visual reasoning. By optimizing for the graph as a whole rather than individual tokens, the model achieves near-zero formatting failure rates and state-of-the-art performance in scene graph generation. Future work will explore the integration of explicit Chain-of-Thought reasoning to further enhance spatial deliberation.

Summary updated

BibTeX
@misc{chen2025compile,
  author = {Zuyao Chen and Jinlin Wu and Zhen Lei and Marc Pollefeys and Chang Wen Chen},
  title = {{Compile Scene Graphs with Reinforcement Learning}},
  year = {2025},
  eprint = {2504.13617},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.13617},
}
Figure