Table of Contents
Fetching ...

Aligning Text, Code, and Vision: A Multi-Objective Reinforcement Learning Framework for Text-to-Visualization

Mizanur Rahman, Mohammed Saidul Islam, Md Tahmid Rahman Laskar, Shafiq Joty, Enamul Hoque

TL;DR

RL-Text2Vis addresses the challenge of translating natural language queries into aligned textual answers and executable visualizations by introducing a reinforcement learning framework built on Group Relative Policy Optimization (GRPO). It formalizes Text2Vis as a post-execution, multi-objective optimization problem, using a two-stage reward that enforces format and jointly optimizes textual correctness, code executability, and visualization quality; the final objective maximizes $\mathbb{E}_{x,y}[R(x,y)]$ without a value network. Empirically, the approach yields substantial gains over zero-shot and supervised baselines, achieving over a 22% relative improvement in chart quality compared to GPT-4o and raising code executability from 78% to 97% on Text2Vis, with strong generalization to VisEval and NVBench. The results demonstrate the practicality of open-source, privacy-preserving multimodal RL for visualization generation and highlight GRPO as an effective strategy for structured, multimodal reasoning in this setting.

Abstract

Text-to-Visualization (Text2Vis) systems translate natural language queries over tabular data into concise answers and executable visualizations. While closed-source LLMs generate functional code, the resulting charts often lack semantic alignment and clarity, qualities that can only be assessed post-execution. Open-source models struggle even more, frequently producing non-executable or visually poor outputs. Although supervised fine-tuning can improve code executability, it fails to enhance overall visualization quality, as traditional SFT loss cannot capture post-execution feedback. To address this gap, we propose RL-Text2Vis, the first reinforcement learning framework for Text2Vis generation. Built on Group Relative Policy Optimization (GRPO), our method uses a novel multi-objective reward that jointly optimizes textual accuracy, code validity, and visualization quality using post-execution feedback. By training Qwen2.5 models (7B and 14B), RL-Text2Vis achieves a 22% relative improvement in chart quality over GPT-4o on the Text2Vis benchmark and boosts code execution success from 78% to 97% relative to its zero-shot baseline. Our models significantly outperform strong zero-shot and supervised baselines and also demonstrate robust generalization to out-of-domain datasets like VIS-Eval and NVBench. These results establish GRPO as an effective strategy for structured, multimodal reasoning in visualization generation. We release our code at https://github.com/vis-nlp/RL-Text2Vis.

Aligning Text, Code, and Vision: A Multi-Objective Reinforcement Learning Framework for Text-to-Visualization

TL;DR

RL-Text2Vis addresses the challenge of translating natural language queries into aligned textual answers and executable visualizations by introducing a reinforcement learning framework built on Group Relative Policy Optimization (GRPO). It formalizes Text2Vis as a post-execution, multi-objective optimization problem, using a two-stage reward that enforces format and jointly optimizes textual correctness, code executability, and visualization quality; the final objective maximizes without a value network. Empirically, the approach yields substantial gains over zero-shot and supervised baselines, achieving over a 22% relative improvement in chart quality compared to GPT-4o and raising code executability from 78% to 97% on Text2Vis, with strong generalization to VisEval and NVBench. The results demonstrate the practicality of open-source, privacy-preserving multimodal RL for visualization generation and highlight GRPO as an effective strategy for structured, multimodal reasoning in this setting.

Abstract

Text-to-Visualization (Text2Vis) systems translate natural language queries over tabular data into concise answers and executable visualizations. While closed-source LLMs generate functional code, the resulting charts often lack semantic alignment and clarity, qualities that can only be assessed post-execution. Open-source models struggle even more, frequently producing non-executable or visually poor outputs. Although supervised fine-tuning can improve code executability, it fails to enhance overall visualization quality, as traditional SFT loss cannot capture post-execution feedback. To address this gap, we propose RL-Text2Vis, the first reinforcement learning framework for Text2Vis generation. Built on Group Relative Policy Optimization (GRPO), our method uses a novel multi-objective reward that jointly optimizes textual accuracy, code validity, and visualization quality using post-execution feedback. By training Qwen2.5 models (7B and 14B), RL-Text2Vis achieves a 22% relative improvement in chart quality over GPT-4o on the Text2Vis benchmark and boosts code execution success from 78% to 97% relative to its zero-shot baseline. Our models significantly outperform strong zero-shot and supervised baselines and also demonstrate robust generalization to out-of-domain datasets like VIS-Eval and NVBench. These results establish GRPO as an effective strategy for structured, multimodal reasoning in visualization generation. We release our code at https://github.com/vis-nlp/RL-Text2Vis.
Paper Structure (34 sections, 8 equations, 8 figures, 6 tables)

This paper contains 34 sections, 8 equations, 8 figures, 6 tables.

Figures (8)

  • Figure 1: An example from Text2Vis text2vis2025. Given the data table and question as input, (a) the baseline model, Qwen2.5-14B-Instruct generates runnable visualization code, but the visualization is not aligned with the query as it shows the growth of renewables quantity instead of the share of total, leading to an incorrect answer. (b) Our RL-Text2Vis-14B produces a correct, query-aligned, and interpretable visualization.
  • Figure 2: GRPO training architecture for text-to-visualization generation, showing policy outputs, multi-objective rewards (answer, code, visualization), combined reward computation, and advantage calculation for policy updates.
  • Figure 3: Error analysis before and after GRPO. GRPO significantly improves text-to-visualization generation by resolving errors such as syntax, value errors, enhancing readability, visual quality, and alignment with the query.
  • Figure 4: Completion length and epoch progression. The model stabilizes in output length while training steps progress linearly.
  • Figure 5: Gradient norm and KL divergence. Indicates optimization stability and policy deviation from the reference model.
  • ...and 3 more figures