遇见数据集

AbstractPhil/json-coco-format

收藏
Hugging Face2026-05-14 更新2026-05-31 收录
官方服务:

资源简介:

--- license: cc-by-4.0 task_categories: - text-generation language: - en pretty_name: JSON COCO Format — task-differentiated SFT data size_categories: - 10K<n<100K configs: - config_name: task_1 data_files: - split: train path: data/task_1.jsonl - config_name: task_2 data_files: - split: train path: data/task_2.jsonl - config_name: task_3 data_files: - split: train path: data/task_3.jsonl - config_name: all data_files: - split: train path: data/all.jsonl tags: - sft - qwen3.5 - tool-use - structured-output - coco - synthetic --- # JSON COCO Format — task-differentiated SFT data A multi-task supervised fine-tuning dataset that teaches a model to convert image-synthesis caption prompts into JSON whose **structure varies by task**. Built from MS-COCO captions (Karpathy split) with Claude Sonnet 4.6 as the teacher; designed for training per-task LoRAs on [Qwen/Qwen3.5-0.8B](https://huggingface.co/Qwen/Qwen3.5-0.8B). Each row is in the Qwen3.5-native tool-call shape: a `messages` array with an assistant turn whose `tool_calls[0].function.arguments` is a dict matching the caption schema, plus a `tools` sibling carrying the per-task tool definition. `tokenizer.apply_chat_template(messages, tools=tools, enable_thinking=False)` produces the qwen3_coder XML training target without further transformation. ## The three tasks The same caption produces three structurally distinct outputs, one per task: ### `task_1` — hallucination_reduction Grounded literal extraction. Subject/action/attribute values come from the caption verbatim. Style and mood are forbidden (always `null`). The validator runs a per-leaf grounding check against the input caption — anything not traceable to the caption is rejected. ```json { "subjects": [ {"name": "bicycle", "attributes": ["black"]}, {"name": "kitchen cabinets", "attributes": []} ], "actions": ["leaning against the kitchen cabinets"], "setting": "indoor", "style": null, "mood": null } ``` ### `task_2` — useful_generalization Encouraged categorical abstraction. Every open-vocab string is a bracketed canonical generic like `[pet]`, `[vehicle]`, `[playing]`. Schema constrains values to regex `^\[[a-z_]+\]$`. The validator enforces the format; semantic correctness is intentionally a soft target — the open vocabulary is what emerged from Claude's actual outputs on real captions. ```json { "subjects": [ {"name": "[vehicle]", "attributes": ["[color]"]}, {"name": "[furniture]", "attributes": []} ], "actions": ["[resting]"], "setting": "[indoor]", "style": null, "mood": null } ``` ### `task_3` — generic_symbolism Pure positional placeholders. Each slot has its own type prefix and 1-based monotonic index. The output captures structural roles with zero semantic content — two completely different captions with the same shape produce identical JSON. ```json { "subjects": [ {"name": "[ENTITY_1]", "attributes": ["[ATTRIBUTE_1]"]}, {"name": "[ENTITY_2]", "attributes": []} ], "actions": ["[ACTION_1]"], "setting": "[INDOOR]", "style": null, "mood": null } ``` ## Dataset statistics | Config | Accepted rows | Rejected (audit only) | Accept rate | |---|---:|---:|---:| | `task_1` (hallucination_reduction) | **20,505** | 2,762 | 88.1% | | `task_2` (useful_generalization) | **21,918** | 159 | 99.3% | | `task_3` (generic_symbolism) | **21,962** | 72 | 99.7% | | `all` (combined, task-tagged) | **64,385** | 2,993 | 95.6% | - Source captions: 22,000 unique COCO captions (min 4 words, deduplicated) - Same 22,000 captions processed by all three tasks - Total rows across tasks: 64,385 accepted, 2,993 rejected - Cost-to-build: ~$293 USD at `claude-sonnet-4-6` rates with prompt caching ## Row schema Every row follows the same outer shape. The variable part is `messages[2].tool_calls[0].function.arguments`, which is the task-shaped JSON. ```json { "prompt": "<source COCO caption verbatim>", "task": "task_1" | "task_2" | "task_3", "messages": [ {"role": "system", "content": "<task-specific system prompt>"}, {"role": "user", "content": "<source caption>"}, {"role": "assistant", "tool_calls": [{ "type": "function", "function": { "name": "emit_caption_schema", "arguments": { "subjects": [...], "actions": [...], "setting": "...", "style": null, "mood": null } } }]} ], "tools": [{"type": "function", "function": { "name": "emit_caption_schema", "description": "Emit the structured caption representation.", "parameters": { ...task-specific JSON Schema overlay... } }}], "meta": { "model": "claude-sonnet-4-6", "schema_valid": true, "validator_passed": true, "tokens_in_uncached": 437, "tokens_out": 145, "tokens_cache_read": 1034, "tokens_cache_create": 0, "cost_usd": 0.00328, "timestamp": "2026-05-14T..." } } ``` The `arguments` field is a real Python dict (not a stringified JSON), which is what Qwen3.5's chat template requires — it iterates `arguments.items()` to emit one `<parameter=NAME>` block per key. ## Usage — load a single task ```python from datasets import load_dataset ds = load_dataset("AbstractPhil/json-coco-format", "task_1", split="train") print(ds[0]["prompt"]) print(ds[0]["messages"][2]["tool_calls"][0]["function"]["arguments"]) ``` ## Usage — produce a Qwen3.5 training prompt ```python from transformers import AutoProcessor processor = AutoProcessor.from_pretrained("Qwen/Qwen3.5-0.8B", trust_remote_code=True) row = ds[0] prompt_text = processor.apply_chat_template( row["messages"], tools=row["tools"], add_generation_prompt=False, # full conversation including assistant turn tokenize=False, enable_thinking=False, ) print(prompt_text) # <|im_start|>system # # Tools ... <tools>{...}</tools> # ...task system prompt... # <|im_end|> # <|im_start|>user # <caption> # <|im_end|> # <|im_start|>assistant # <think> # # </think> # # <tool_call> # <function=emit_caption_schema> # <parameter=subjects> # [...] # </parameter> # ... # </function> # </tool_call><|im_end|> ``` ## How this dataset was made 1. Stream 22,000 unique captions from [yerevann/coco-karpathy](https://huggingface.co/datasets/yerevann/coco-karpathy) train split (min 4 words, deduplicated, take order from the stream). 2. For each caption × each task, prompt Claude Sonnet 4.6 via the Anthropic API using a task-specific system prompt + a task-specific tool schema overlay on a shared base `Caption` JSON Schema. 3. Validate every output: - `task_1`: per-leaf grounding check (every leaf string must trace to the source caption by substring or token match). - `task_2`: every open-vocab value must match `^\[[a-z_]+\]$`. - `task_3`: typed numbered placeholders (`[ENTITY_N]`, `[ATTRIBUTE_N]`, `[ACTION_N]`) with monotonic numbering within each slot. 4. Accepted rows → `data/task_N.jsonl`. Rejected rows → `rejects/task_N.jsonl` with reasons, retained for audit. The combined task-tagged dataset is at `data/all.jsonl`. Per-task system prompts and validators live in the [qwen-test-runner](https://github.com/AbstractEyes/qwen-test-runner) repo's `qwen_test_runner/tasks.py`. The build pipeline (`prompt_maker.py`) is resumable — re-running picks up from the last on-disk row via a per-task seen-set of input-prompt hashes. ## Rejection patterns (so you know what was filtered out) - **task_1 (2,762 rejects):** virtually all are grounding flags — Claude tends to phrase actions slightly beyond literal, e.g. `"flower arrangement placed in the middle of the table"` for a caption that says `"with a flower arrangement in the middle"`. The validator is intentionally strict for the hallucination-reduction objective. - **task_2 (159) / task_3 (72):** schema slips — Claude occasionally wrapping an action in a dict instead of a plain string (`{"name": "[resting]"}`), or one missing-bracket typo (`"[young"`). Rare tail-cases. `rejects/task_N.jsonl` rows include the raw model output and reject reasons in case you want to relax the validator or recover them. ## Intended use - Train per-task LoRAs on Qwen3.5-0.8B (or other small instruction-tuned models that emit qwen3_coder-format tool calls). - Each task is a distinct training distribution; one LoRA per task is the default plan. A single multi-task LoRA could also be trained off `all` with `row["task"]` as a conditioning tag. ## Source attribution and license - Source captions: MS-COCO captions (Chen et al., 2015), Karpathy split as redistributed in [yerevann/coco-karpathy](https://huggingface.co/datasets/yerevann/coco-karpathy). Licensed CC-BY-4.0. - Generated JSON outputs: produced by Anthropic's Claude Sonnet 4.6 under user-provided prompts. - This derivative dataset is released under **CC-BY-4.0**, preserving the upstream COCO license. ## Companion repo Build pipeline, task registry, validators, and Qwen test harness: [github.com/AbstractEyes/qwen-test-runner](https://github.com/AbstractEyes/qwen-test-runner)

JSON COCO Format — task-differentiated SFT data is a multi-task supervised fine-tuning dataset that teaches a model to convert image-synthesis caption prompts into JSON whose structure varies by task. Built from MS-COCO captions (Karpathy split) with Claude Sonnet 4.6 as the teacher; designed for training per-task LoRAs on Qwen/Qwen3.5-0.8B. The dataset includes three tasks: task_1 (hallucination_reduction) requires grounded literal extraction from captions; task_2 (useful_generalization) encourages categorical abstraction with canonical generic terms; task_3 (generic_symbolism) uses pure positional placeholders. It contains 64,385 accepted rows and 2,993 rejected rows, licensed under CC-BY-4.0.

提供机构:
AbstractPhil
搜集汇总
数据集介绍
AbstractPhil/json-coco-format 数据集图片
构建方式
在工具调用监督微调与结构化输出研究的交汇处,将图像描述转译为可验证JSON语料是连接视觉语言与可执行模式的关键环节。json-coco-format以MS-COCO Karpathy划分中22,000条去重英文描述为源,逐条与三项任务配对,经由Claude Sonnet 4.6依据任务特定系统提示及共享Caption JSON Schema叠加工具模式生成输出。所有候选样本分别接受叶级接地、正则约束与占位符单调编号校验,合格行汇入data/task_N.jsonl,拒斥行留存于rejects/task_N.jsonl备查。构建管线具备断点续跑能力,总成本约293美元。
使用方法
在Qwen3.5等小规模指令模型的结构化工具调用训练中,数据装载与聊天模板应用需严格匹配原生工具调用格式。研究者可调用datasets.load_dataset并选择task_1、task_2、task_3或all配置,获取对应训练划分。取行后以AutoProcessor.from_pretrained加载Qwen/Qwen3.5-0.8B,调用apply_chat_template传入messages与tools,设置add_generation_prompt=False、tokenize=False、enable_thinking=False,即可生成qwen3_coder XML训练目标。默认方案为逐任务训练LoRA;若基于all配置训练多任务LoRA,可将行内task字段用作条件标签。
背景与挑战
背景概述
在视觉语言与结构化生成的交叉领域,将自然图像字幕转译为机器可解析的JSON表示,是衔接多模态语义理解与工具调用式语言模型的重要环节。AbstractPhil发布json-coco-format数据集,基于MS-COCO Karpathy划分的22,000条唯一字幕,由Claude Sonnet 4.6担任教师模型,在Qwen3.5原生工具调用形态下生成随任务分化的SFT样本。其核心研究问题在于令小型指令模型Qwen3.5-0.8B以每任务LoRA方式,分别习得降低幻觉的接地抽取、开放词汇的范畴泛化以及无涉语义的位置符号化,从而回应结构化输出中语义忠实与模式控制的平衡难题。构建管线与校验器位于AbstractEyes/qwen-test-runner,行级元数据记录了2026年五月的生成时间戳。该资源为小模型工具调用与可验证结构化生成提供了可审计的训练基底。
当前挑战
面向结构化输出与指令微调的数据构建,往往同时承受语义忠实性与模式可控性的双重压力。json-coco-format所对应的领域问题,是使模型在相同字幕上生成结构随任务而变的JSON——既要task_1逐叶接地、抑制幻觉,又要task_2输出受正则约束的开放词汇范型,还要task_3以单调编号占位符剥离语义。构建挑战集中体现为教师输出与严格校验之间的张力:task_1因动作措辞略越出字面而被拒2,762条,接受率88.1%;task_2与task_3出现动作被包装成字典、缺失括号等模式滑移,分别拒159与72条。任务特定系统提示、工具schema叠加、可恢复流水线及约293美元生成成本,构成质量与规模控制的现实约束。
常用场景
经典使用场景
在结构化视觉语言监督微调领域,JSON COCO Format 数据集以 MS-COCO 字幕为源文本,将同一字幕映射为依任务而变的 JSON 表征,并通过 Qwen3.5 原生工具调用模板组织训练样本。其经典用法是加载 task_1、task_2、task_3 或 all 配置,以 messages 与 tools 字段经 apply_chat_template 生成 qwen3_coder XML 训练目标,进而为 Qwen3.5-0.8B 等小模型训练逐任务 LoRA。task_1 强调逐字锚定与幻觉抑制,task_2 鼓励类别抽象,task_3 则输出带类型与序号的占位符,三者共同构成受控的结构化生成实验台。
解决学术问题
面向视觉字幕与多模态语义解析中的可复现难题,该数据集着重回应结构化输出中的幻觉控制、开放词表泛化与符号化抽象之间的张力。它通过逐叶锚定校验限制 task_1 的越界生成,以正则约束保障 task_2 的括号化类别规范,并借单调编号占位符检验 task_3 的结构角色学习。由此,研究者可在同一字幕集上比较事实约束、类别泛化与纯结构生成三类目标,为工具调用格式学习、JSON Schema 遵循和低资源指令模型的行为分析提供受控基准,其意义在于把数据构建、验证与训练目标显式耦合。
实际应用
在图像合成提示理解、多模态数据治理与轻量代理部署中,该数据集具备直接落地价值。其样本可服务于从自然语言字幕到结构化 JSON 的解析器训练,用于图像生成提示分解、视觉内容标注、检索索引构建以及工具调用式接口填充。task_1 可支撑事实一致的字幕要素抽取,task_2 适用于需类别归一化的工业标注流程,task_3 则利于模板化占位与位置敏感的结构迁移。鉴于其面向 Qwen3.5-0.8B 等小模型设计,该资源亦适合边缘端 LoRA 微调、私有化结构化输出服务与可审计的多任务适配实验。
数据集最近研究
最新研究方向
面向多任务结构化生成的监督微调正由通用指令微调转向任务条件化、schema约束与可验证对齐。json-coco-format以MS-COCO字幕为源,借助Claude Sonnet 4.6构造同一语义在幻觉抑制、泛化抽象与符号占位三类任务下的异构JSON,为Qwen3.5-0.8B的per-task LoRA提供细粒度监督。其前沿价值在于将工具调用格式、结构化输出验证与幻觉溯源检查耦合,回应小模型可靠工具使用、合成数据配比和任务冲突缓解等热点。该数据集使schema遵循、开放词汇归一化与无语义占位生成得以分离评估,为可控生成、多任务适配器与可审计数据管线研究提供可复现基准。
以上内容由遇见数据集搜集并总结生成
二维码
社区交流群
二维码
科研交流群
商业服务