DanielRegaladoCardoso/chart-reasoning-mix-v1
收藏资源简介:
--- language: - en license: apache-2.0 task_categories: - text-generation tags: - chart-generation - data-visualization - storytelling-with-data - chart-spec - sql - llm-distillation pretty_name: Chart Reasoning Mix v1 size_categories: - 10K<n<100K --- # Chart Reasoning Mix v1 Training data for fine-tuning compact LLMs (Phi-3 Mini, Qwen 2.5 3B) to map **(natural-language question + SQL result schema) to a storytelling-grade chart specification**. > Part of the [SQL Agent LLMOps](https://github.com/DanielRegaladoUMiami/sql-agent-llmops) project. | Total | Sources | Storytelling fields | |-------|---------|---------------------| | **35,167 rows** | 2 (nvBench real + OpenAI synth) | chart_type, encoding, title, sort, color_strategy, rationale | ## Part of the SQL Agent LLMOps project | Dataset | Model | Role | |---------|-------|------| | [`DanielRegaladoCardoso/text-to-sql-mix-v2`](https://huggingface.co/datasets/DanielRegaladoCardoso/text-to-sql-mix-v2) | Qwen 2.5 Coder 7B | NL question to SQL | | **[`DanielRegaladoCardoso/chart-reasoning-mix-v1`](https://huggingface.co/datasets/DanielRegaladoCardoso/chart-reasoning-mix-v1)** | **Phi-3 Mini 3.8B** | **(question + result) to chart spec** | | [`DanielRegaladoCardoso/svg-chart-render-v1`](https://huggingface.co/datasets/DanielRegaladoCardoso/svg-chart-render-v1) | DeepSeek Coder 1.3B | chart spec to SVG | ## Schema Each row contains: | Field | Type | Description | |-------|------|-------------| | `id` | string | Stable hash-based identifier | | `instruction` | string | Natural-language question | | `data_profile` | string (JSON) | SQL result column schema: name, type, sample rows | | `chart_spec` | string (JSON) | Target chart specification (see below) | | `source` | string | `nvbench` or `synth-openai-gpt41nano` | | `difficulty` | string | `easy`, `medium`, `hard`, or `unknown` | ### chart_spec structure ```json { "chart_type": "bar|line|scatter|donut|histogram|boxplot|area|heatmap|sankey|funnel", "encoding": {"x": "col", "y": "col", "color": "col|null", "size": "col|null", "facet": "col|null"}, "title": "Insight-driven title (not just the topic)", "sort": {"by": "col", "order": "asc|desc|natural"}, "color_strategy": "highlight|categorical|sequential|diverging", "rationale": "One sentence explaining why this chart type was chosen" } ``` Note: `data_profile` and `chart_spec` are stored as JSON strings in the parquet. Parse with `json.loads(row["chart_spec"])` after loading. ## Splits | Split | Rows | |-------|------| | train | 33,408 | | validation | 879 | | test | 880 | ## Source attribution This dataset combines the following sources: | Source | Tag in `source` | Rows | License | Link | Notes | |--------|-----------------|------|---------|------|-------| | nvBench (Tsinghua DB Group) | `nvbench` | 24,201 | MIT | [GitHub](https://github.com/TsinghuaDatabaseGroup/nvBench) | Gold-standard NL-to-visualization benchmark. 7,247 base entries with up to 5 NL paraphrases each. Chart types: bar, line, scatter, donut. Titles backfilled from NL questions. | | OpenAI gpt-4.1-nano synthesis | `synth-openai-gpt41nano` | 9,207 | Apache-2.0 | [text-to-sql-mix-v2](https://huggingface.co/datasets/DanielRegaladoCardoso/text-to-sql-mix-v2) | Chart specs synthesized from SQL mix v2 questions via OpenAI Batch API. System prompt distills Tufte/Knaflic/Few storytelling principles. Includes insight-driven titles and rationale. | ## Storytelling principles The synthesis system prompt distills data-visualization best practices from: - **Edward Tufte** -- data-ink ratio, integrity, small multiples - **Cole Nussbaumer Knaflic** -- clutter elimination, action-driven titles - **Stephen Few** -- perceptual encoding, dashboard hygiene Models trained on this dataset learn: - Correct chart type selection (from 33k examples) - Axis encoding (which column maps to x/y/color) - Insight-driven titles ("Sales grew 47% in Q4" not "Sales by month") - Smart sorting (value-desc for rankings, natural for time) - Color strategy (highlight key finding, gray background) - Rationale (model can explain its choice) ## Pipeline Build script: [`training/data_pipelines/build_chart_mix.py`](https://github.com/DanielRegaladoUMiami/sql-agent-llmops/blob/main/training/data_pipelines/build_chart_mix.py) Stages: `nvbench` (load + convert) -> `synth-prepare` (sample SQL mix, build batch JSONL) -> `synth-submit` (OpenAI Batch API) -> `synth-fetch` (download results) -> `combine-push` (merge, dedup, split, push). Title enrichment: [`training/data_pipelines/enrich_chart_titles.py`](https://github.com/DanielRegaladoUMiami/sql-agent-llmops/blob/main/training/data_pipelines/enrich_chart_titles.py) ## Usage ```python from datasets import load_dataset import json ds = load_dataset("DanielRegaladoCardoso/chart-reasoning-mix-v1") ex = ds["train"][0] spec = json.loads(ex["chart_spec"]) print(ex["instruction"]) print(spec["chart_type"], spec["title"]) print(spec["rationale"]) ``` ## Known limitations - nvBench titles are derived from the NL question (descriptive, not insight-driven). Only synth rows (28%) have true storytelling titles. - `data_profile` does not include actual row data -- only column names and types. The model cannot reason about specific values. - Difficulty labels are heuristic, not human-judged. ## Citation ```bibtex @dataset{regalado2026chartmix, author = {Regalado Cardoso, Daniel}, title = {Chart Reasoning Mix v1}, year = {2026}, url = {https://huggingface.co/datasets/DanielRegaladoCardoso/chart-reasoning-mix-v1} } ``` Plus the original nvBench citation: ```bibtex @inproceedings{luo2021nvbench, title = {Synthesizing Natural Language to Visualization (NL2VIS) Benchmarks from NL2SQL Benchmarks}, author = {Luo, Yuyu and Tang, Nan and Li, Guoliang and Tang, Jiawei and Chai, Chengliang and Qin, Xuedi}, booktitle = {SIGMOD}, year = {2021} } ``` ## License Pipeline and curation: **Apache-2.0**. Row content inherits upstream licenses (MIT for nvBench, Apache-2.0 for synth). See source attribution table. --- _Built by Daniel Regalado Cardoso -- MSBA, University of Miami -- April 2026._
--- 语言: - 英语 许可证:Apache-2.0 任务类别: - 文本生成 标签: - 图表生成 - 数据可视化 - 数据叙事 - 图表规范 - SQL - 大语言模型蒸馏(LLM Distillation) 友好名称:Chart Reasoning Mix v1 数据量范围: - 10K < 样本量 < 100K --- # 图表推理混合集v1(Chart Reasoning Mix v1) 本数据集用于微调紧凑型大语言模型(LLM),包括Phi-3 Mini、Qwen 2.5 3B,实现**「自然语言问题+SQL结果模式」到符合叙事标准的图表规范**的映射。 > 本数据集属于[SQL Agent LLMOps(SQL智能体大语言模型运维)](https://github.com/DanielRegaladoUMiami/sql-agent-llmops)项目的一部分。 | 总数据量 | 数据来源 | 叙事相关字段 | |---------|---------|---------------------| | **35,167 条数据** | 2 个(真实nvBench数据集 + OpenAI合成数据集) | 图表类型、编码规则、标题、排序规则、色彩策略、合理性说明 | ## 隶属于SQL智能体大语言模型运维(LLMOps)项目的数据集生态 | 数据集路径 | 所用模型 | 任务角色 | |---------|-------|------| | [`DanielRegaladoCardoso/text-to-sql-mix-v2`](https://huggingface.co/datasets/DanielRegaladoCardoso/text-to-sql-mix-v2) | Qwen 2.5 Coder 7B | 自然语言问题转SQL语句 | | **[`DanielRegaladoCardoso/chart-reasoning-mix-v1`](https://huggingface.co/datasets/DanielRegaladoCardoso/chart-reasoning-mix-v1)** | **Phi-3 Mini 3.8B** | **「问题+查询结果」映射至图表规范** | | [`DanielRegaladoCardoso/svg-chart-render-v1`](https://huggingface.co/datasets/DanielRegaladoCardoso/svg-chart-render-v1) | DeepSeek Coder 1.3B | 图表规范转SVG格式 | ## 数据模式 每个数据行包含以下字段: | 字段名 | 数据类型 | 字段说明 | |-------|------|-------------| | `id` | 字符串 | 基于哈希的稳定标识符 | | `instruction` | 字符串 | 自然语言问题 | | `data_profile` | 字符串(JSON格式) | SQL结果列模式:包含列名、数据类型、样本行数据 | | `chart_spec` | 字符串(JSON格式) | 目标图表规范(详见下文) | | `source` | 字符串 | 取值为`nvbench`或`synth-openai-gpt41nano` | | `difficulty` | 字符串 | 取值为`easy`(简单)、`medium`(中等)、`hard`(困难)或`unknown`(未知) | ### 图表规范(chart_spec)结构 json { "chart_type": "bar|line|scatter|donut|histogram|boxplot|area|heatmap|sankey|funnel", "encoding": {"x": "col", "y": "col", "color": "col|null", "size": "col|null", "facet": "col|null"}, "title": "Insight-driven title (not just the topic)", "sort": {"by": "col", "order": "asc|desc|natural"}, "color_strategy": "highlight|categorical|sequential|diverging", "rationale": "One sentence explaining why this chart type was chosen" } 注意:`data_profile`与`chart_spec`在Parquet文件中以JSON字符串格式存储,加载后需通过`json.loads(row["chart_spec"])`进行解析。 ## 数据集划分 | 划分集 | 数据量 | |-------|------| | 训练集 | 33,408 | | 验证集 | 879 | | 测试集 | 880 | ## 来源说明 本数据集整合了以下数据源: | 数据源 | `source`字段标签 | 数据量 | 许可证 | 链接 | 备注 | |--------|-----------------|------|---------|------|-------| | nvBench(清华大学数据库组) | `nvbench` | 24,201 | MIT许可证 | [GitHub](https://github.com/TsinghuaDatabaseGroup/nvBench) | 金标准自然语言转可视化(NL2VIS)基准数据集。包含7,247条基础条目,每条可生成最多5条自然语言复述版本。支持的图表类型包括柱状图、折线图、散点图、环形图。标题由自然语言问题补全生成。 | | OpenAI gpt-4.1-nano 合成数据集 | `synth-openai-gpt41nano` | 9,207 | Apache-2.0许可证 | [text-to-sql-mix-v2](https://huggingface.co/datasets/DanielRegaladoCardoso/text-to-sql-mix-v2) | 图表规范由SQL混合集v2的问题通过OpenAI批量API合成生成。系统提示提取了Edward Tufte、Cole Nussbaumer Knaflic和Stephen Few的数据叙事原则。包含符合叙事要求的标题与合理性说明。 | ## 数据叙事原则 本合成任务的系统提示提取了以下学者的数据可视化最佳实践: - **爱德华·塔夫特(Edward Tufte)**:数据墨水比、数据完整性、小多图原则 - **科尔·努斯鲍默·克纳夫利奇(Cole Nussbaumer Knaflic)**:去除视觉冗余、行动导向型标题 - **斯蒂芬·菲尤(Stephen Few)**:感知编码、仪表盘设计规范 基于本数据集训练的模型可学习以下能力: - 从3.3万条示例中学习正确的图表类型选择逻辑 - 掌握轴编码规则(确定各列与X/Y轴、颜色映射的对应关系) - 生成洞察导向型标题(例如“第四季度销售额增长47%”而非“月度销售额”) - 实现智能排序(针对排名任务按数值降序排列,针对时间序列采用自然时序排序) - 合理运用色彩策略(高亮关键发现项,其余元素采用灰色背景) - 生成合理性说明(模型可解释自身的图表选择依据) ## 数据处理流程 构建脚本:[`training/data_pipelines/build_chart_mix.py`](https://github.com/DanielRegaladoUMiami/sql-agent-llmops/blob/main/training/data_pipelines/build_chart_mix.py) 处理流程步骤:`nvbench`(加载与格式转换)-> `synth-prepare`(采样SQL混合集,构建批量JSONL文件)-> `synth-submit`(调用OpenAI批量API)-> `synth-fetch`(下载合成结果)-> `combine-push`(合并、去重、划分数据集并推送至Hub)。 标题增强脚本:[`training/data_pipelines/enrich_chart_titles.py`](https://github.com/DanielRegaladoUMiami/sql-agent-llmops/blob/main/training/data_pipelines/enrich_chart_titles.py) ## 使用示例 python from datasets import load_dataset import json ds = load_dataset("DanielRegaladoCardoso/chart-reasoning-mix-v1") ex = ds["train"][0] spec = json.loads(ex["chart_spec"]) print(ex["instruction"]) print(spec["chart_type"], spec["title"]) print(spec["rationale"]) ## 已知局限性 - nvBench数据集的标题源自原始自然语言问题,仅为描述性标题,而非洞察导向型标题。仅28%的合成数据样本具备真正符合叙事要求的标题。 - `data_profile`字段不包含实际行数据,仅提供列名与数据类型信息,模型无法针对具体数值进行推理。 - 难度标签基于启发式规则生成,未经人工标注审核。 ## 引用格式 bibtex @dataset{regalado2026chartmix, author = {Regalado Cardoso, Daniel}, title = {Chart Reasoning Mix v1}, year = {2026}, url = {https://huggingface.co/datasets/DanielRegaladoCardoso/chart-reasoning-mix-v1} } 以及nvBench原始数据集的引用格式: bibtex @inproceedings{luo2021nvbench, title = {Synthesizing Natural Language to Visualization (NL2VIS) Benchmarks from NL2SQL Benchmarks}, author = {Luo, Yuyu and Tang, Nan and Li, Guoliang and Tang, Jiawei and Chai, Chengliang and Qin, Xuedi}, booktitle = {SIGMOD}, year = {2021} } ## 许可证 数据集处理流程与标注规则采用**Apache-2.0**许可证。每条数据的内容继承上游数据源的许可证:nvBench数据集采用MIT许可证,合成数据集采用Apache-2.0许可证。详见来源说明表格。 --- _由Daniel Regalado Cardoso 制作 -- 迈阿密大学商业分析硕士项目 -- 2026年4月。_



