Guides

Stable Diffusion Prompt 技巧:高级指南

M
Mourad Z.AI & Prompt Engineering Specialist
2025年1月3日
5 分钟阅读

通过这些高级 prompt 技巧精通 Stable Diffusion。学习语法、权重、负面 prompt 和模型特定策略。

Stable Diffusion Prompt 技巧:高级指南
分享:

精通 Stable Diffusion Prompt

Stable Diffusion 为 AI 图像生成提供了无与伦比的控制力——前提是你知道如何使用它。与更简单的界面不同,Stable Diffusion 会用精准定制的结果来回报你的技术知识。本指南涵盖了能够提升你 Stable Diffusion 创作水平的高级 prompt 技巧。

无论你使用的是 AUTOMATIC1111 的 Web UI、ComfyUI 还是其他界面,这些技巧都广泛适用。我们将讲解 prompt 语法、权重设置、负面 prompt、模型特定策略和高级工作流程。

理解 Prompt 语法

Stable Diffusion 解读 prompt 的方式与自然语言 AI 不同。理解其语法至关重要:

基本结构:Prompt 以逗号分隔的概念方式处理。每个概念独立解读,然后组合在一起。"a red car, sunset, beach" 处理为三个独立的元素。

词序很重要:排在前面的 token 通常获得更多关注。把最重要的概念放在最前面。

圆括号强调:(word) 将注意力提高 1.1 倍。((word)) 提高 1.21 倍(1.1 的平方)。嵌套超过 3-4 层后效果递减。

方括号弱化:[word] 将注意力降低 0.9 倍。[[word]] 降低 0.81 倍。适用于微妙的背景元素。

显式权重:(word:1.5) 设定精确的注意力权重。通常使用 0.5-1.5 的范围。超过 2.0 往往会产生伪影。

SyntaxEffectMultiplierExample
(word)Increase attention1.1x(beautiful landscape)
((word))Strong increase1.21x((detailed eyes))
(word:1.5)Explicit weight1.5x(golden hour:1.5)
[word]Decrease attention0.9x[background trees]
[word:0.5]Explicit reduction0.5x[clouds:0.5]
[word1:word2:0.5]Prompt switchingAt 50% of steps[cat:dog:0.5] blends concepts

Recommended Sampler Settings

For photorealism: DPM++ 2M Karras, 25-30 steps, CFG 7-8

For artistic/stylized: Euler a, 20-25 steps, CFG 7-9

For speed: DPM++ SDE Karras, 15-20 steps, CFG 7

For maximum detail: DPM++ 2M Karras, 40-50 steps, CFG 7-8, with Hires. fix

精通负面 Prompt

负面 prompt 是 Stable Diffusion 真正大放异彩的地方。它们告诉模型要避免什么,从而显著提升质量。

基本负面 Prompt 模板:从基于质量的负面词开始:"blurry, low quality, lowres, bad anatomy, bad hands, cropped, worst quality, low quality, normal quality, jpeg artifacts, watermark, text, signature"

风格特定的负面词:根据你的目标风格添加负面词:

追求写实效果:"cartoon, anime, illustration, painting, drawing, art, sketch"

追求动漫/插画:"photorealistic, photograph, 3d, 3d render, realistic"

追求干净图像:"busy background, cluttered, noisy, grainy"

解剖负面词:"bad anatomy, bad hands, missing fingers, extra fingers, extra limbs, missing limbs, fused fingers, too many fingers, mutated hands, malformed limbs, extra arms, extra legs"

面部负面词:"deformed face, ugly face, asymmetric eyes, bad eyes, cross-eyed, blurry face"

高级 Prompt 权重

策略性的权重设置可以创造细腻的结果:

主体强调:给主要对象分配比背景元素更高的权重。"(beautiful woman:1.3), garden background, soft lighting" 将注意力集中在主体上。

风格平衡:组合不同风格时设定权重:"portrait, (oil painting:0.8), (impressionist:0.6)" 创造出微妙的风格混合。

细节控制:对细节关键词设定权重:"landscape, mountains, (intricate details:1.2), (8k:1.1)" 但不要过度。

Prompt 混合:使用 [from:to:when] 语法实现过渡:"[day:night:0.5]" 在生成步骤的 50% 处从白天过渡到夜晚。

模型特定策略

不同的 Stable Diffusion 模型对不同的方法有不同的响应:

SDXL:比 SD 1.5 更好地处理自然语言。可以使用更长、更具描述性的 prompt。受益于详细的场景描述。推荐分辨率:1024x1024 或类似。

SD 1.5 模型:偏好关键词风格的 prompt。更短、更聚焦的 prompt 效果更好。许多模型针对特定风格训练——使用它们的触发词。常用分辨率:512x512。

写实模型(如 Realistic Vision):受益于摄影术语:"DSLR, 85mm, f/1.8, bokeh"。包含光线描述:"studio lighting, natural light, rim light"。引用相机设置以增加真实感。

动漫模型:使用动漫特定的质量标签:"masterpiece, best quality, highly detailed"。包含艺术风格参考:"by (artist name)"。角色描述关键词比自然语言更重要。

构图与布局控制

通过 prompt 引导图像构图:

视角关键词:"wide shot, close-up, medium shot, bird's eye view, worm's eye view, Dutch angle, straight-on, profile view"

取景:"centered, rule of thirds, symmetrical, asymmetrical, full body, portrait, headshot"

空间关系:明确说明位置关系:"woman standing in foreground, mountains in background, river between them"

宽高比考量:让你的 prompt 与输出比例相匹配。竖向比例适合肖像;横向比例适合风景。

质量提升关键词

以下关键词能持续改善效果:

通用质量:"masterpiece, best quality, highly detailed, sharp focus, professional, high resolution, 8k, 4k"

光线:"beautiful lighting, dramatic lighting, soft lighting, volumetric lighting, cinematic lighting, golden hour, rim light"

渲染:"detailed, intricate, elaborate, highly detailed, fine details, sharp, crisp"

艺术质量:"award-winning, trending on artstation, artstation quality, deviantart quality"

注意:效果因模型而异。测试什么对你使用的特定检查点有效。

高级工作流技巧

使用这些高级方法提升你的创作:

渐进式优化:先在较低步数/分辨率下生成,快速迭代。找到好的构图后,再以更高质量重新生成。

种子操控:锁定种子以保持构图不变,同时调整 prompt。使用 seed+1、seed+2 来寻找相似但不同的变体。

Prompt 调度:在生成过程中切换 prompt:"[detailed background:simple background:0.6]" 从详细背景开始,转为简洁背景。

通配符:使用通配符语法增加多样性:"a __color__ __animal__ in a __setting__" 从预定义列表中提取。

ControlNet 集成:将文本 prompt 与 ControlNet 结合,精确控制姿势、构图和风格,同时保留 prompt 的影响力。

常见问题排查

过饱和/伪影:降低强调权重。降低 CFG scale。添加质量负面词。

忽略 Prompt 部分内容:提高被忽略概念的权重。将重要元素移到前面。简化 prompt——太多概念会分散注意力。

风格不一致:使用更具体的风格关键词。尝试更适合你目标风格的不同模型。增加风格相关的权重。

解剖错误:添加全面的解剖负面词。尝试不同的模型。使用 ControlNet 引导姿势。在更高分辨率下生成。

结语

Stable Diffusion 的复杂性正是它的优势——掌握这些技巧给你带来其他更简单平台无法比拟的创意控制力。从基础开始,逐步融入高级技巧,并始终保持实验精神。

请记住,不同的模型有不同的响应方式。对一个检查点有效的方法可能需要在另一个上进行调整。为你偏好的模型建立个人有效 prompt 库,并在不断学习中持续优化你的方法。

Stable Diffusion 社区不断发现新技巧。保持活跃在论坛、Discord 服务器和 GitHub 仓库中,让你的技能保持与时俱进。祝生成愉快!

M

Mourad Z.

AI & Prompt Engineering Specialist

Mourad is a prompt engineering specialist and co-founder of Reprompte. With deep expertise in AI image generation tools like Midjourney, Stable Diffusion, and DALL-E, he helps creators unlock the full potential of AI art through effective prompting techniques.

相关文章

准备创建精彩的提示词?

使用我们免费的AI提示词生成器将这些技巧付诸实践。立即将您的想法转化为优化的提示词。