네거티브 프롬프트와 제외 항목
흐림, 워터마크, 추함, 변형 등 제외할 요소와 효과적인 네거티브 프롬프트 작성법을 알아봅니다.
네거티브 프롬프트와 제외 항목은(는) CoddyKit의 무료 AI Prompt Engineering 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 AI Prompt Engineering 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. AI Prompt Engineering 강의에는 총 4개의 강의가 포함되어 있습니다.
negative 프롬프트란 무엇인가요
negative 프롬프트는 이미지 모델에 generate된 이미지에 무엇을 포함하지 말아야 하는지 알려 줍니다. 이는 긍정 프롬프트와 분리되어 있으며, 원치 않는 아티팩트와 스타일, 요소에서 벗어나도록 generation을 유도합니다. 원래 스테이블 디퓨전의 기능이었던 이 개념은 여러 이미지 generation 모델로 확산되었습니다.
스테이블 디퓨전 negative 프롬프트 구문
스테이블 디퓨전에서는 negative 프롬프트를 별도의 매개변수로 전달합니다. 모델은 이를 반대 유도로 처리합니다. 즉, negative 프롬프트의 개념이 generation 중에 적극적으로 배제됩니다.
import requests
SD_API_URL = 'http://localhost:7860/sdapi/v1/txt2img'
def generate_sd_image(positive_prompt, negative_prompt, steps=30, cfg_scale=7):
payload = {
'prompt': positive_prompt,
'negative_prompt': negative_prompt,
'steps': steps,
'cfg_scale': cfg_scale, # 7-12 recommended
'width': 512,
'height': 512,
'sampler_name': 'DPM++ 2M Karras'
}
response = requests.post(SD_API_URL, json=payload)
return response.json()
# Example call with negative prompt
positive = (
'portrait of a young woman, soft natural light, '
'professional photography, sharp focus, elegant'
)
negative = (
'blurry, watermark, text, logo, ugly, distorted, '
'deformed, extra fingers, extra limbs, bad anatomy, '
'low quality, low resolution, grainy, noisy, '
'oversaturated, harsh shadows'
)
result = generate_sd_image(positive, negative)
print('Generated:', len(result.get('images', [])), 'images')범용 품질 negative 프롬프트
표준 negative 프롬프트 용어 모음은 거의 모든 주제에서 출력 품질을 향상합니다. 이를 기본 시작점으로 외워 두거나 저장해 두세요.
# Universal quality negative prompt
QUALITY_NEGATIVES = [
# Technical quality issues
'blurry', 'out of focus', 'low quality', 'low resolution',
'pixelated', 'grainy', 'noisy', 'compressed artifacts', 'jpeg artifacts',
# Anatomical distortions (common AI failure mode)
'extra fingers', 'extra limbs', 'extra arms', 'deformed hands',
'bad anatomy', 'malformed', 'mutated', 'disfigured',
# Unwanted elements
'watermark', 'text', 'logo', 'signature', 'caption',
'border', 'frame', 'username',
# Stylistic failures
'ugly', 'poorly drawn', 'amateur', 'sketch',
'unfinished', 'rough draft',
# Color problems
'oversaturated', 'washed out', 'overexposed', 'underexposed'
]
UNIVERSAL_NEGATIVE = ', '.join(QUALITY_NEGATIVES)
print('Universal negative prompt:')
print(UNIVERSAL_NEGATIVE[:200], '...')해부학 및 신체 negative 프롬프트
AI 이미지 모델은 손과 손가락을 생성하는 데 어려움을 겪는 것으로 유명합니다. 구체적인 해부학적 negative 프롬프트를 사용하면 사람 형상을 generate할 때 이러한 아티팩트를 크게 줄일 수 있습니다.
ANATOMY_NEGATIVES = [
# Hand and finger issues
'extra fingers', 'missing fingers', 'deformed fingers',
'fused fingers', 'too many fingers', 'six fingers',
'wrong number of fingers', 'extra hands', 'floating hand',
# Face issues
'distorted face', 'asymmetrical face', 'multiple faces',
'merged faces', 'duplicate head', 'two heads',
'extra eyes', 'missing eyes', 'heterochromia (if not desired)',
# Body proportions
'extra legs', 'extra arms', 'floating limbs',
'bad proportions', 'unrealistic body proportions',
'torso too long', 'missing torso',
# Skin
'skin blemishes', 'skin texture issues'
]
BODY_NEGATIVE = ', '.join(ANATOMY_NEGATIVES)
# Full portrait negative prompt combining quality + anatomy
PORTRAIT_NEGATIVE = UNIVERSAL_NEGATIVE + ', ' + BODY_NEGATIVE
print('Portrait negative length:', len(PORTRAIT_NEGATIVE.split(',')), 'terms')negative 프롬프트를 사용한 스타일 제외
negative 프롬프트를 사용하면 원치 않는 스타일을 제외할 수 있습니다. 이는 긍정 프롬프트의 스타일 용어가 피하고 싶은 유사한 스타일을 끌어들일 때 유용합니다. 일반적인 스타일 제외 항목은 다음과 같습니다:
style_exclusion_examples = [
{
'goal': 'Oil painting portrait without cartoonish look',
'positive': 'oil painting portrait, classical technique, highly detailed',
'negative': 'cartoon, anime, illustration, flat colors, cel-shaded, vector'
},
{
'goal': 'Photorealistic image without HDR over-processing',
'positive': 'photorealistic landscape, natural light, DSLR quality',
'negative': 'HDR, hyper-saturated, over-processed, Instagram filter, tone-mapped'
},
{
'goal': 'Dark fantasy without gore',
'positive': 'dark fantasy warrior, dramatic lighting, detailed armor',
'negative': 'gore, blood, violence, disturbing content, horror'
},
{
'goal': 'Vintage look without actual age degradation',
'positive': 'vintage 1960s photograph, film grain, warm tones',
'negative': 'deteriorated, damaged, torn, stains, yellowed, faded'
}
]
for ex in style_exclusion_examples[:2]:
print(f'Goal: {ex["goal"]}')
print(f'Negative: {ex["negative"][:60]}...')
print()DALL-E 제외 구문
DALL-E 3에는 별도의 negative 프롬프트 필드가 없습니다. 대신 제외 사항은 긍정 프롬프트 안에 ‘피하기’, ‘without’, ‘없음’ 또는 ‘포함하지 않기’와 같은 표현을 사용하여 자연스럽게 작성합니다.
import openai
client = openai.OpenAI(api_key='YOUR_API_KEY')
# DALL-E 3: exclusions in the positive prompt
dalle_prompt_with_exclusions = (
'A professional portrait photograph of a businesswoman in a modern office. '
'Natural window light, shallow depth of field, warm tones. '
'Do not include: any text, watermarks, logos, or captions. '
'Avoid: cartoon or illustrated style, anime, artificial-looking skin. '
'The image should have no distracting background elements. '
'Realistic and natural — not over-processed or filtered.'
)
response = client.images.generate(
model='dall-e-3',
prompt=dalle_prompt_with_exclusions,
size='1024x1024',
quality='hd',
n=1
)
image_url = response.data[0].url
print('Generated image URL:', image_url[:60], '...')negative 프롬프트 강도와 CFG 스케일
스테이블 디퓨전에서 CFG(분류기 없는 유도) 스케일은 프롬프트(긍정 및 negative)가 generation에 미치는 영향의 강도를 제어합니다. CFG가 높을수록 더 강하게 따르지만 아티팩트가 발생할 수 있습니다.
# CFG scale guide for Stable Diffusion
cfg_guide = {
3: 'Very loose adherence, creative/random, may ignore negative prompts',
5: 'Balanced: creative but follows prompts generally',
7: 'Standard: good balance of quality and adherence (recommended default)',
10: 'Strong adherence: follows both positive and negative prompts closely',
12: 'Very strong: highly literal, may oversaturate colors or cause artifacts',
15: 'Extreme: usually causes artifacts, rarely useful'
}
# Parenthetical weighting in Stable Diffusion
# Surround a term with () to increase its weight
# surround with [] to decrease its weight
weighted_negative = (
'(blurry:1.3), (extra fingers:1.5), watermark, '
'[slight noise:0.5], text'
# extra fingers gets 1.5x negative weight (most important to avoid)
# blurry gets 1.3x negative weight
# slight noise gets reduced 0.5x weight (tolerate a little)
)
print('CFG=7 (recommended default) balances quality and prompt adherence')
print('Weighted negative example:', weighted_negative[:80], '...')negative 프롬프트 라이브러리 구축
사용 사례마다 필요한 negative 프롬프트 모음이 다릅니다. 모든 generation 작업에 함께 조합할 수 있는 분야별 negative 프롬프트 라이브러리를 구축하세요.
NEGATIVE_PROMPT_LIBRARY = {
'quality_base': (
'blurry, low quality, low resolution, pixelated, '
'watermark, text, logo, signature'
),
'anatomy': (
'extra fingers, deformed hands, bad anatomy, '
'extra limbs, distorted face'
),
'portrait_specific': (
'double chin exaggerated, skin blemishes, '
'red eye, harsh shadows on face'
),
'landscape_specific': (
'overcast flat light, washed out colors, '
'lens flare, chromatic aberration'
),
'product_photo': (
'shadow on product, uneven background, '
'reflection glare, dust spots'
),
'no_style_bleed': (
'anime, cartoon, illustration, painting, '
'sketch (when photorealism is desired)'
)
}
def compose_negative(*keys):
return ', '.join(NEGATIVE_PROMPT_LIBRARY[k] for k in keys)
# Portrait generation
portrait_neg = compose_negative('quality_base', 'anatomy', 'portrait_specific')
print('Portrait negative:', portrait_neg[:100], '...')
# Product photo generation
product_neg = compose_negative('quality_base', 'product_photo', 'no_style_bleed')
print('Product negative:', product_neg[:100], '...')negative 프롬프트가 실패하는 경우
negative 프롬프트가 항상 보장하는 것은 아닙니다. 원치 않는 요소가 나타날 확률을 낮추지만 완전히 제거하지는 못합니다. 언제 실패하는지 이해하면 현실적인 기대치를 설정하는 데 도움이 됩니다.
negative_prompt_limitations = {
'Failure: Concept too abstract': {
'problem': '"bad" is too vague for the model to act on',
'fix': 'Use specific concrete terms: "blurry", "deformed", "watermark"'
},
'Failure: Contradiction with positive prompt': {
'problem': 'Positive: "detailed painting" | Negative: "painting"',
'fix': 'Narrow negative to the specific aspect: negative: "amateur painting, rough sketch"'
},
'Failure: Too many negative terms dilute effect': {
'problem': '200-word negative prompt where each term gets minimal weight',
'fix': 'Limit to 15-20 terms. Use weighting for most critical: "(extra fingers:1.5)"'
},
'Failure: Watermarks still appear': {
'problem': 'Some model checkpoints are strongly trained on watermarked data',
'fix': 'Use a different model checkpoint or use an inpainting pass to remove'
}
}
for failure, info in negative_prompt_limitations.items():
print(f'{failure}')
print(f' Problem: {info["problem"]}')
print(f' Fix: {info["fix"]}')
print()negative 프롬프트의 효과 테스트
특정 사용 사례에서 실제로 결과를 개선하는 negative 프롬프트가 무엇인지 체계적으로 테스트합니다. negative 프롬프트를 사용한 경우와 사용하지 않은(without) 경우에 generate한 결과를 고정된 시드로 비교하세요.
import requests
SD_API_URL = 'http://localhost:7860/sdapi/v1/txt2img'
def test_negative_prompts(positive, negative_variants, seed=42, steps=30):
results = []
for label, negative in negative_variants.items():
payload = {
'prompt': positive,
'negative_prompt': negative,
'seed': seed, # fixed seed for fair comparison
'steps': steps,
'cfg_scale': 7
}
response = requests.post(SD_API_URL, json=payload)
results.append({
'label': label,
'negative': negative[:60] + '...',
'image_count': len(response.json().get('images', []))
})
return results
# Test different negative prompt levels
variants = {
'no_negative': '',
'quality_only': 'blurry, low quality, watermark',
'anatomy_added': 'blurry, low quality, watermark, extra fingers, bad anatomy',
'full_library': compose_negative('quality_base', 'anatomy', 'portrait_specific')
}
print('Testing negative prompt variants with fixed seed...')
print('Compare output images to identify which negative terms have the most impact.')미드저니 No-Parameter
미드저니는 negative 프롬프트에 해당하는 방식으로 --no 매개변수를 사용합니다. 구문은 다르지만 개념은 동일합니다. 프롬프트 끝에 --no [term1] [term2]를 추가합니다.
# Midjourney negative prompt syntax using --no parameter
midjourney_prompts = [
# Basic exclusion
'professional headshot portrait, soft studio lighting, --no text watermark logo background',
# Style exclusion
'oil painting of a medieval castle, dramatic lighting --no modern cars people telephone wires',
# Anatomy
'full body character art, hero pose --no extra fingers deformed limbs bad anatomy',
# Content exclusion
'children\'s book illustration of a forest --no violence scary dark horror'
]
# Midjourney also supports emphasis with :: weighting
weighted_midjourney = (
'A serene Japanese garden::2, cherry blossoms::1.5, '
'koi pond, stone lantern --no people tourists modern buildings::3'
# ::2 = 2x weight on the garden
# ::3 on the no-people exclusion = very strong exclusion
)
for prompt in midjourney_prompts[:3]:
print('Midjourney:', prompt[:70], '...')빠른 확인
스테이블 디퓨전에서 특정 negative 용어가 다른 용어보다 더 큰 영향력을 갖게 하는 기법은 무엇인가요?
negative 프롬프트 요약
negative 프롬프트는 원치 않는 특성에서 벗어나도록 이미지 generation을 유도하는 강력한 도구입니다:
- 스테이블 디퓨전: 별도의
negative_prompt매개변수를 사용하며 괄호 가중치를 지원합니다 - DALL-E 3: 긍정 프롬프트에 ‘avoid’, ‘without’, ‘do not include’를 사용합니다
- 미드저니: 프롬프트에
--no [terms]를 추가합니다 - 범용 negative 항목: 흐릿함, 낮은 품질, 워터마크, 텍스트, 여분의 손가락
- CFG 스케일: 프롬프트(긍정 및 negative)가 generation을 유도하는 강도를 제어합니다
- 제한 사항: 제외될 확률을 낮추지만 완전히 보장하지는 않으며, 최대 15~20개 용어를 사용합니다
자주 묻는 질문
“네거티브 프롬프트와 제외 항목” 강의는 무료인가요?
네 — “네거티브 프롬프트와 제외 항목” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 AI Prompt Engineering 강의 전체를 잠금 해제할 수 있습니다. AI Prompt Engineering 강의에는 총 4개의 강의가 포함되어 있습니다.
“네거티브 프롬프트와 제외 항목”에서 뭘 배우나요?
흐림, 워터마크, 추함, 변형 등 제외할 요소와 효과적인 네거티브 프롬프트 작성법을 알아봅니다. 브라우저에서 직접 실행하는 실습 코드로 AI Prompt Engineering을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
AI Prompt Engineering을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 AI Prompt Engineering은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.
“네거티브 프롬프트와 제외 항목” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 AI Prompt Engineering 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 AI Prompt Engineering 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 이미지 생성 프롬프트의 구조
- 스타일 및 예술 매체 지정
- 네거티브 프롬프트와 제외 항목
- 반복적인 이미지 프롬프트 개선