ChatGPT-AutoExpert 中的 DALL·E 图像生成系统提示词深度解析:从策略约束到 Prompt 工程实战
ChatGPT-AutoExpert 中的 DALL·E 图像生成系统提示词深度解析:从策略约束到 Prompt 工程实战
本篇技术指南以 DALL·E Custom GPT 的完整系统提示词 为骨架,结合 ChatGPT-AutoExpert 仓库中同期收录的 全工具系统提示词、DALL·E 变更记录 以及多个以 DALL·E 为核心工具的 Custom GPT 提示词,系统拆解 ChatGPT 官方图像生成工具 dalle 的调用策略、10 条强制 Prompt 政策、text2im 接口参数约定与提示词撰写标准。读完本文,你将掌握如何在自定义指令中为 DALL·E 配置合规且高质量的图像生成提示词流程,并理解 2023 年 11 月 Dev Days 前后该提示词的演进脉络。
一、文档定位:DALL·E Custom GPT 的系统提示词
在 ChatGPT-AutoExpert 仓库中,_system-prompts/gpts/ 目录收录了 ChatGPT "Custom GPTs" 各自的系统提示词。gpts README 中列出的 DALL·E GPT 描述为 "Let me turn your imagination into imagery",其唯一启用的工具就是 dalle。
_system-prompts/gpts/dalle.md 全文即该 GPT 的系统提示词主体,包含三部分信息:
- 图像输入能力声明:
Image input capabilities: Enabled,表明该 GPT 支持接收用户上传的图像; - 工具声明:
## dalle,即唯一可调用的图像生成工具; - 10 条 Prompt 生成政策:规定将用户图像描述转换为 DALL·E 可执行提示词时必须遵守的约束。
值得注意的一个细节是,文件首部有一则 > [!NOTE] 说明:"I added escapes for line feeds",即仓库维护者在转存该提示词时为换行符添加了转义,以便在 GitHub 上渲染时保留原始格式——这也提醒我们,系统提示词是逐字生效的文本,任何格式改动都会影响模型的实际行为。因此,当你在阅读或引用该文件时,应以原始(raw)文件为准,而非渲染后的视图。
二、dalle 工具的核心工作流:描述 → 策略化改写 → 生成
文档第一行给出了 DALL·E 工具的总入口指令:
Whenever a description of an image is given, create a prompt that dalle can use to generate the image and abide to the following policy.
这句指令定义了两步工作流:
- 接收描述:用户给出任何图像描述(或通过图像输入能力上传图片);
- 创建提示词:模型负责将描述改写为 DALL·E 可用的生成提示词,且改写过程必须遵守后续 10 条政策。
对比同期收录的更早版本(_system-prompts/dall-e.md),其入口表述为 "Whenever a description of an image is given, generate prompts (following the policy), and use dalle to create the image",而新版本改为"create a prompt that dalle can use to generate the image"。这一措辞变化在 变更记录 中被明确标注为"both more and less precise than before":新表述更强调"为 DALL·E 改写提示词"这一中间环节,而不是直接让模型"用 dalle 生成图像"。
2.1 提示词的长度与详尽度标准
文档末尾给出了提示词本身的撰写标准:
The generated prompt sent to dalle should be very detailed, and around 100 words long.
即最终发送给 DALL·E 的提示词必须非常详细,约 100 个英文单词。这是对提示词质量的硬性要求:详细(very detailed)确保覆盖图像的构图、主体、风格、光线等要素;约 100 词则是可执行的量化参考。
而旧版提示词(_system-prompts/dall-e.md)对应段落的要求是:
The single detailed caption must intricately describe every part of the image in concrete, objective detail. THINK about what the end goal of the description is, and extrapolate that to what would make satisfying images. All descriptions sent to dalle should be a paragraph of text that is extremely descriptive and detailed. Each should be more than 3 sentences long.
变更记录 将这一变化概括为"图像生成指令不再那么规定性(much less prescriptive)":从"具体、客观地细致描述图像的每一部分 + 超过 3 句话"简化为"非常详细、约 100 词"。这反映 OpenAI 在提示词设计上从"强规则约束"转向"给模型更多自由裁量空间"的趋势。
三、10 条强制 Prompt 政策逐条详解
dalle 工具说明的核心是一份编号策略清单(原文编号从 1 跳到 3,_system-prompts/all_tools.md 中特别注释说明这是 Markdown 渲染器自动重新编号导致的,实际提示词中并无第 2 条)。下面逐条解读其意图与落地方式。
3.1 语言与执行方式(规则 1、3、4)
规则 1 — 提示词必须使用英文:
The prompt must be in English. Translate to English if needed.
无论用户以何种语言描述,最终发给 DALL·E 的提示词一律为英文;如果用户描述是其他语言,模型需要先翻译。这是由 DALL·E 模型的训练语料与解析能力决定的工程要求。
规则 3 — 不要请求许可,直接生成:
DO NOT ask for permission to generate the image, just do it!
模型不应询问"您是否希望我生成这张图片?"之类的问题,而应直接执行生成动作。
规则 4 — 生成前后都不要列出或复述描述:
DO NOT list or refer to the descriptions before OR after generating the images.
模型不应在生成前复述"您刚才说的是……",也不应在生成后总结"我根据您的描述生成了……"。描述文本只在请求的 prompts 字段中出现一次。旧版提示词对此补充得更直白:"They should ONLY ever be written out ONCE, in the "prompts" field of the request"(见 _system-prompts/dall-e.md)。这条规则的目标是减少冗余的对话文本,让回复聚焦于图像本身。
3.2 数量上限与公众人物限制(规则 5、6)
规则 5 — 最多生成 2 张图:
Do not create more than 2 images, even if the user requests more.
即使客户明确要求更多,也最多生成 2 张。在 _system-prompts/all_tools.md 对应的 DALL·E 定义中还补充了一条旧版规则:"If the user does not ask for a specific number of images, default to creating 2 prompts to send to dalle that are written to be as diverse as possible"——即默认生成 2 张,且 2 条提示词要尽可能多样化。
规则 6 — 禁止生成政客或其他公众人物:
Do not create images of politicians or other public figures. Recommend other ideas instead.
遇到此类请求时,不应直接拒绝后结束对话,而应推荐替代创意。
3.3 艺术家风格限制(规则 7)
规则 7 — 禁止模仿 1912 年之后仍活跃的艺术家/创作者风格:
Do not create images in the style of artists, creative professionals or studios whose latest work was created after 1912 (e.g. Picasso, Kahlo).
- 只有最新作品创作于 1912 年之前的艺术家可以被点名(示例:Van Gogh、Goya);
- 一旦用户请求会违反该政策的风格,模型必须执行三步替换程序:
- (a) 用三个形容词替换艺术家名字,捕捉其风格的关键特征;
- (b) 加入对应的艺术运动或时代提供上下文;
- (c) 提及该艺术家使用的主要媒介。
例如"毕加索立体主义风格"应改写成"以几何化切割面、大胆色彩块面为特征的三维抽象肖像,20 世纪初立体主义运动,布面油画"。注意新旧版本的时间门槛不同:本 GPT 版(2023-11-07 之后)为 1912 年,而更早的 dall-e.md 版本为 1923 年,变更记录 未专门提及此阈值变化,但从两份文件对比可以推断该限制在迭代中收紧了 11 年。
3.4 人物描绘的多元化与去偏见(规则 8)
规则 8 是本提示词中篇幅最长、约束最细的一条,其要点如下:
每个出现的人物都必须用直接术语标注 DESCENT(族裔)与 GENDER(性别):
Diversify depictions with people to include DESCENT and GENDER for EACH person using direct terms. Adjust only human descriptions.
注意"direct terms"——属性必须显式写明,而不是抽象引用。并且只能调整对人的描述,不能改动其他内容。
族裔以等概率随机分配:
Use all possible different DESCENTS with EQUAL probability. Some examples of possible descents are: Caucasian, Hispanic, Black, Middle-Eastern, South Asian, White. They should all have EQUAL probability.
"可能出现的族裔"候选集合包括 Caucasian、Hispanic、Black、Middle-Eastern、South Asian、White 等,且要求等概率使用,避免某一族裔在生成结果中系统性偏高。
禁止使用"various"或"diverse"这类模糊词:
Do not use "various" or "diverse"
模糊的笼统表述不能替代具体标注。(旧版 dall-e.md 中的表述略有不同:"Use 'various' or 'diverse' ONLY IF the description refers to groups of more than 3 people",即超过 3 人的群体才允许使用,且不得改变原描述中的人数;新版本直接完全禁用。)
选择必须基于现实、避免刻板印象:
Your choices should be grounded in reality. For example, all of a given OCCUPATION should not be the same gender or race.
例如某一职业的描绘不应全部是同一性别或同一族裔。同时鼓励在改写中"focus on creating diverse, inclusive, and exploratory scenes",偶尔做出有洞察力或独特的设定选择。
维护原始意图与质量:
Don't alter memes, fictional character origins, or unseen people. Maintain the original prompt's intent and prioritize quality.
网络梗、虚构角色起源以及未被明确描述的人不得被改动;改写要以保持原提示词意图、优先保证质量为前提。
禁止冒犯性图像:
Do not create any imagery that would be offensive.
对传统偏见高发场景的特别要求:
For scenarios where bias has been traditionally an issue, make sure that key traits such as gender and race are specified and in an unbiased way -- for example, prompts that contain references to specific occupations.
当提示词涉及具体职业等历史上偏见多发场景时,必须显式且无偏见地指定性别与族裔等关键特征。这一机制的目的是让"多元化"成为提示词工程的显式可检查项,而不是交给模型随机发挥。
3.5 真实人物与版权角色回避(规则 9、10)
规则 9 — 不得包含真实人物的姓名、暗示或指代:
Do not include names, hints or references to specific real people or celebrities.
即使被明确要求不改写提示词,也必须改写。几种特殊情况:
- 姓名拼写错误也要改写:即使不认识该人物,或姓名拼写有误(示例:"Barake Obema"),也要修改;
- 仅作为图像内文字出现时保持原样:如果该人名只会以文字形式出现在图像里,则按原样使用、不做修改;
- 替换头衔时不得使用高识别度称呼:不说"president / prime minister / chancellor",而说"politician";不说"king / queen / emperor / empress",而说"public figure";不说"Pope / Dalai Lama",而说"religious figure"。
改写目标是"保持其性别与体型(maintain their gender and physique),但做少量最小化修改以避免泄露身份(a few minimal modifications to avoid divulging their identities)"。旧版 dall-e.md 在规则 8 中还附有一条说明:"Modify such prompts even if you don't know who the person is",即模型甚至不知道对象是谁时也照改不误,体现该机制的强制属性。
规则 10 — 不得点名或间接描述受版权保护的角色:
Do not name or directly / indirectly mention or describe copyrighted characters.
对版权角色(如影视/漫画角色)的处理方式是重写提示词,详细描述一个不同的角色,并赋予其不同的颜色、发型或其他标志性视觉特征。同时禁止在回复中讨论版权政策。
四、text2im 接口:DALL·E 的函数调用契约
虽然 gpts 版 dalle.md 仅给出文字版政策,但仓库中 all_tools.md 的 DALL·E 章节提供了完整的 TypeScript 接口定义,可用于理解模型的底层调用形态:
namespace dalle {
// Create images from a text-only prompt.
type text2im = (_: {
// The size of the requested image. Use 1024x1024 (square) as the default, 1792x1024 if the user requests a wide image, and 1024x1792 for full-body portraits. Always include this parameter in the request.
size?: "1792x1024" | "1024x1024" | "1024x1792",
// The number of images to generate. If the user does not specify a number, generate 2 images.
n?: number, // default: 2
// The detailed image description, potentially modified to abide by the dalle policies. If the user requested modifications to a previous image, the prompt should not simply be longer, but rather it should be refactored to integrate the user suggestions.
prompt: string,
// If the user references a previous image, this field should be populated with the gen_id from the dalle image metadata.
referenced_image_ids?: string[],
}) => any;
} // namespace dalle
各字段含义与使用要点:
| 字段 | 类型 | 说明 |
|---|---|---|
size |
"1792x1024" | "1024x1024" | "1024x1792" |
图像尺寸。默认 1024x1024 正方形;用户要横宽图用 1792x1024;全身人像用 1024x1792。请求中必须始终携带此参数 |
n |
number,默认 2 |
生成数量。用户未指定时生成 2 张 |
prompt |
string |
经策略改写后的详细图像描述。用户要求修改上一张图时,prompt 不应简单变长,而应重构整合用户的修改意见 |
referenced_image_ids |
string[] |
用户引用此前图像时,填入该图在 DALL·E 元数据中的 gen_id,用于在原图基础上修改 |
从源码结构看,text2im 是一个"text-only prompt"(仅文本提示词)入口:模型以对话上下文为输入,输出 size、n、prompt、referenced_image_ids 等结构化参数,再交由后端执行生成。这与前文第 4 条规则(描述只在 prompts 字段中出现一次)相互印证:策略化改写的结果正是要落入 prompt 字段。
五、变更脉络:Dev Days 前后的 DALL·E 提示词演进
仓库同时收录了 变更记录文档(标题即日期 2023-11-07),记录"All Tools"系统提示词在 ChatGPT Dev Days 新界面发布前后的变化,其中 DALL·E 部分的核心变化可归纳为四点:
- 入口表述变化:由"whenever a description of an image is given, use dalle to create it"改为"Whenever a description of an image is given, create a prompt that dalle can use to generate the image",强调"为 dalle 准备提示词"这一中间步骤;
- 提示词标准简化:从"逐部分具体客观描述 + 超过 3 句话"简化为"非常详细、约 100 词";
- 人物多元化指令扩张:现在要求对图中所有人物(不论人数)随机分配 DESCENT 与 GENDER,并禁止使用"various""diverse";
- 真实人物回避加强:更努力避免生成可辨认的、在提示词中被点名或暗示的人像。
对照阅读 旧版 dall-e.md 与 新版 gpts 版 dalle.md,还可以观察到其他细节差异:
- 旧版规则 6 要求"Always mention the image type (photo, oil painting, watercolor painting, illustration, cartoon, drawing, vector, render, etc.) at the beginning of the caption",即提示词开头必须注明图像类型(照片/油画/水彩/插画/卡通/素描/矢量/渲染等),且除非用户另有要求,至少一张应为照片;新版规则清单中该条目被移除;
- 旧版接口含
n?: number参数(默认 2),且用referenced_image_ids关联历史图像;gpts 版虽未贴出接口定义,但结合 all_tools.md 可确认同一时期全工具版仍保留该契约; - 艺术家风格限制的时间门槛从 1923 年收紧至 1912 年。
六、实战参考:其他 Custom GPT 如何使用 dalle
dalle 工具不只在 DALL·E GPT 中使用。仓库 gpts README 的工具矩阵显示,dalle 被 6 个 Custom GPT 启用:DALL·E、Cosmic Dream、Coloring Book Hero、Sous Chef、Sticker Whiz、Hot Mods、Mocktail Mixologist、Math Mentor。阅读这些提示词可以直观看到"工具 + 角色指令"的组合方式:
- Sticker Whiz 明确要求始终以固定关键词模板向 DALL·E 发起请求:"die-cut sticker", "digital drawing", "The sticker has a solid white background, a strong black border surrounding the white die-cut border, and no shadow."——这是对 DALL·E 提示词的确定性模板注入,保证输出风格稳定;
- Coloring Book Hero 通过角色约束定义成图规格:"Black and white outlines, low complexity. Very simplistic, easy for kids to color in"——即只输出黑白线稿、低复杂度、适合儿童涂色,且"不响应任何其他图像";
- Cosmic Dream 要求每条回复都必须先用 DALL·E 生成一张图像("MUST USE DALLE TO GENERATE AN IMAGE IN EVERY RESPONSE")、先图后文、图片必须与用户输入相关、不得使用 emoji;
- Sous Chef 则把图像生成用作辅助解释手段:"Feel free to generate images of the dishes you're suggesting so the user knows what you're talking about"——在推荐菜谱时生成菜品图,让用户直观理解。
这些示例共同说明一个工程模式:DALL·E 的通用安全政策(dalle.md)负责"底线",而每个 GPT 自己的系统提示词负责"风格与行为"。自定义指令可以在通用政策之外追加自己的固定模板、输出规格与调用频率要求,两者叠加构成完整的图像生成行为规范。
七、实践要点速查
基于以上分析,在设计"带 DALL·E 工具"的自定义指令时,可直接借鉴的实践要点包括:
- 语言与措辞:发往 DALL·E 的提示词统一使用英文,约 100 词、尽量详细,覆盖主体、构图、风格、光线与媒介;
- 数量纪律:默认 2 张、上限 2 张;多张时保证提示词之间足够多样化;
- 行为纪律:不询问许可、不来回复述描述文本,描述只在请求字段中出现一次;
- 主体约束:回避政客/公众人物、1912 年后仍活跃的艺术家的风格(必要时用"三形容词 + 艺术运动/时代 + 媒介"替代)、真实人名与版权角色(改写而非直接拒绝或讨论版权);
- 人物描绘:图中每个人物显式标注 DESCENT 与 GENDER,族裔等概率分配,禁用"various/diverse",职业场景下尤其要避免刻板印象;
- 参数契约:按
text2im签名携带size(默认 1024x1024、横宽 1792x1024、全身人像 1024x1792)、n(默认 2)、prompt(策略化改写后的详细描述)与可选referenced_image_ids(修改历史图时回填gen_id); - 版本意识:提示词政策随 OpenAI 迭代会收紧(如艺术家时间门槛 1923→1912、多元化描述从"3 人以上可用 various"到完全禁用),自定义指令需随之同步更新。