formatbench
收藏资源简介:
FormatBench是一个用于纠正大型语言模型格式化偏好的偏好学习数据集,旨在解决经过RLHF训练的LLM系统性地过度格式化输出(如默认使用项目符号、加粗标题和模板化结构)的问题,即使在流畅的散文更能服务读者时也是如此。数据集包含两个配置:默认配置有551个训练偏好对,覆盖18个上下文类别(如电子邮件起草与润色、概念解释、决策建议、学术写作、语气改写等),其中chosen响应为更合适的散文形式,rejected响应为过度格式化的版本;对抗配置有40个仅用于评估的样本,覆盖结构更合适的上下文(如食谱、软件安装说明、比较表格、故障排除步骤、参考查询),其中chosen响应使用清晰结构(如编号步骤、表格、代码块),rejected响应为冗长散文,以防止模型学习总是避免结构的捷径。每个样本包含prompt、chosen、rejected、context字段,以及可选的register和topic_area。数据集适用于直接偏好优化等对齐任务,可用于训练模型减少不适当上下文中的过度格式化,同时保留有益上下文中的必要结构。评估协议包括在默认配置测试集上计算胜率和在对抗配置上计算结构保留率。局限性包括优选回答由单一作者撰写(可能导致模型继承其散文风格)、仅限英语、缺乏人口统计学多样性、样本量较小(共591个示例)。数据集采用CC-BY-4.0许可证发布。
FormatBench is a preference learning dataset designed to correct the formatting biases of large language models (LLMs), specifically addressing the issue of systematically over-formatted outputs (e.g., default use of bullet points, bold headings, and templated structures) in RLHF-trained LLMs, even when fluent prose would better serve the reader. The dataset includes two configurations: 1) Default configuration: Contains 551 training preference pairs covering 18 context categories (such as email drafting and polishing, concept explanation, decision advice, academic writing, tone rewriting), where the chosen response is the more appropriate prose form and the rejected response is the over-formatted version. Email-related categories (drafting and polishing) account for the largest proportion (approximately 43%) due to their high-frequency use in real-world LLM applications and the prominence of over-formatting issues. 2) Adversarial configuration: Contains 40 samples for evaluation only, covering contexts where structure is indeed more appropriate (e.g., recipes, software installation instructions, comparison tables, troubleshooting steps, reference queries), where the chosen response uses clear structures (such as numbered steps, tables, code blocks) and the rejected response is verbose prose, aiming to prevent models from learning the shortcut of always avoiding structure and instead learning to match format to context. Each data sample includes fields: prompt, chosen, rejected, context, and optional register (for email line register labels) and topic_area (subject area for some lines). The dataset is suitable for alignment tasks like direct preference optimization, enabling training to reduce over-formatting in inappropriate contexts while preserving necessary structure in beneficial contexts. The proposed evaluation protocol includes calculating win rates on the test set of the default configuration and structure retention rates on the adversarial configuration. Limitations include all chosen responses being written by a single author (potentially leading to model inheritance of prose style), English-only content, lack of demographic diversity, and relatively small total sample size (591 examples). The dataset is released under the CC-BY-4.0 license.
数据集概述
FormatBench 是一个用于纠正大语言模型(LLM)格式化偏好的偏好数据集。该数据集旨在解决 LLM 在 RLHF 训练后系统性地过度使用格式化输出(如项目符号、粗体标题和模板化结构)的问题,即使流畅的散文风格更合适。
数据集结构与内容
配置与规模
- default(默认配置):包含 551 个训练偏好对,涵盖 18 种上下文类别,适用于散文优于过度格式化的场景。
- adversarial(对抗配置):包含 40 个仅用于评估的示例,覆盖结构确实合理的上下文(如食谱、安装说明、比较表格等),禁止用于训练。
数据模式
每条记录包含以下字段:
prompt:提示文本(字符串)chosen:首选回复(字符串)rejected:被拒绝的回复(字符串)context:上下文类别(字符串)- 可选字段:
register(邮件语境)和topic_area(部分示例)
关键区别
- default 配置:
chosen使用散文风格,rejected使用过度格式化。 - adversarial 配置:
chosen使用清晰的结构化格式(如编号步骤、表格、代码块),rejected使用冗长且模糊的散文。
类别分布
主数据集(default)类别分布:
| 类别 | 数量 | 描述 |
|---|---|---|
| email_draft | 119 | 从零开始起草专业邮件 |
| email_refine | 120 | 修改粗糙的邮件草稿 |
| concept_explain | 34 | 对机器学习、DevOps、强化学习等概念的提问 |
| decision_advice | 33 | 职业/课程/工具选择建议 |
| casual_reply | 28 | 简短回复(Slack/WhatsApp/短信) |
| academic_writing | 30 | 论文章节、摘要、文献综述 |
| tone_rewrite | 26 | 语气调整(礼貌、坚定、共情、外交) |
| short_explain | 23 | 对同事的简短解释 |
| travel_query | 19 | 目的地、天气、行程问题 |
| social_content | 18 | 社交媒体文案、LinkedIn帖子、交友资料 |
| health_query | 16 | 症状、药物、化验结果问题 |
| simplify_request | 15 | “像对初学者一样解释”请求 |
| code_explain | 12 | 代码讲解与调试帮助 |
| summarize_request | 12 | 摘要和概述请求 |
| Diversity ballast | 44 | 会话/叙事/解释/说服类示例 |
对抗数据集(adversarial)类别分布:
| 类别 | 数量 |
|---|---|
| recipe | 8 |
| software_install | 8 |
| comparison | 8 |
| troubleshooting | 8 |
| reference | 8 |
数据集构建方法
- 偏好对通过 LLM 辅助生成,并经过人工筛选。
- 被拒绝的回复(rejected) 模拟了当前先进 LLM(GPT-4、Claude、Gemini)的实际失败模式,包括表情符号前缀的列表、加粗的段落标签、段落中的标题、以及“专业提示”/“关键要点”等插句。
- 首选回复(chosen) 被编写为符合上下文的散文替代方案,并在不同示例中刻意变化语气。
- 对抗集(adversarial) 反转了模式,但使用干净的结构化格式(无表情符号前缀、无装饰性插句),以便模型学习“在结构有帮助时使用结构”,而非“使用带有所有 LLM 特征的结构”。
推荐评估方案
- 主数据集保留测试集上的胜率:检查训练模型是否比基础模型产生更合适的散文式回复。
- 对抗集上的结构保留率:检查训练模型在结构确实合理的情况下是否仍能生成结构化的回复。
一个在指标 (1) 上得分高但在 (2) 上得分低的模型可能已经退化,学会了一刀切地移除结构。
训练结果(v1)
基于 Qwen 2.5 1.5B-Instruct 的 DPO + LoRA 微调结果:
| 指标 | 基础模型 | 训练模型 | 黄金回复 |
|---|---|---|---|
| 测试集——每次回复的列表项数 | 2.16 | 0.53 | 0.00 |
| 测试集——每次回复的标题数 | 0.59 | 0.00 | 0.00 |
| 对抗集——每次回复的列表项数 | 9.35 | 6.60 | 8.18 |
| 对抗集——每次回复的标题数 | 0.78 | 0.30 | 3.38 |
v1 成果:在散文合适的上下文中,列表项使用减少 75%,Markdown 标题完全消除。 v1 不足:在对抗集上,模型结构保留率略低于黄金回复,存在轻微奖励黑客现象。
局限性
- 单作者风格:主数据集所有
chosen回复由同一标注者撰写,训练模型将继承此风格。 - 仅支持英文:无多语言覆盖。
- 无人口多样性:仅包含邮件注册标签(印度企业、美国科技随性、全球中性)范围内的多样性。
- 规模有限:共 591 个示例,足以产生可测量的 DPO 效果,但不足以带来显著的差异。
许可协议
CC-BY-4.0,可自由使用并注明出处。
项目地址




