docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거

Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,171 @@
---
id: wiki-2026-0508-부정-프롬프트와-가중치를-활용한-시각적-아티팩트-artif
title: 부정 프롬프트와 가중치를 활용한 시각적 아티팩트(Artifact) 디버깅 및 제어
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Negative Prompt, Prompt Weighting, Artifact Debugging]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [diffusion, prompt-engineering, sdxl, flux, image-gen]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: python
framework: diffusers
---
# 부정 프롬프트와 가중치를 활용한 시각적 아티팩트(Artifact) 디버깅 및 제어
## 매 한 줄
> **"매 artifact 매 unwanted concept 의 누출"**. Diffusion model 의 산출물 의 extra fingers, melted face, watermark 의 매 negative prompt + token weighting 의 conditional vector 조정 의 억제. 매 2026 의 FLUX 매 negative prompt 의존도 ↓ — guidance distillation 으로 quality 자체 ↑.
## 매 핵심
### 매 메커니즘
- Classifier-Free Guidance (CFG): `noise = uncond + scale * (cond - uncond)`.
- Negative prompt 의 `uncond` 의 대체 — 매 "이쪽 으로 가지 마" vector.
- Token weighting (`(token:1.3)`) 매 cross-attention 의 token embedding scale.
### 매 흔한 artifact
- **Anatomy**: extra fingers, deformed hands, asymmetric eyes.
- **Composition**: cropped head, floating limbs, tangent edges.
- **Quality**: blur, jpeg artifact, low resolution, oversaturation.
- **Concept leak**: text/watermark, signature, logo.
### 매 응용
1. SDXL/SD3 매 negative prompt 의 default workflow 에 포함.
2. FLUX/SD3.5 매 prompt weighting 의존도 ↓ — guidance distilled.
3. Inpainting fix — masked region 만 negative prompt 의 적용.
## 💻 패턴
### diffusers — negative prompt 기본
```python
from diffusers import StableDiffusionXLPipeline
import torch
pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16
).to("cuda")
img = pipe(
prompt="portrait of a woman, studio light, sharp focus, 50mm lens",
negative_prompt=(
"deformed, extra fingers, mutated hands, asymmetric eyes, "
"lowres, jpeg artifacts, watermark, signature, text, blurry"
),
guidance_scale=7.0,
num_inference_steps=30,
).images[0]
```
### compel — token weighting (SDXL)
```python
from compel import Compel, ReturnedEmbeddingsType
compel = Compel(
tokenizer=[pipe.tokenizer, pipe.tokenizer_2],
text_encoder=[pipe.text_encoder, pipe.text_encoder_2],
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
requires_pooled=[False, True],
)
prompt = "a (majestic:1.3) lion, (golden mane:1.2), (cinematic:0.8)"
neg = "(cartoon:1.4), (anime:1.4), (3d render:1.2)"
embeds, pooled = compel(prompt)
neg_embeds, neg_pooled = compel(neg)
img = pipe(
prompt_embeds=embeds, pooled_prompt_embeds=pooled,
negative_prompt_embeds=neg_embeds, negative_pooled_prompt_embeds=neg_pooled,
).images[0]
```
### A1111 syntax (community standard)
```text
# 매 강조 — (token:weight)
masterpiece, (intricate details:1.2), (sharp focus:1.1)
# Negative
(worst quality:1.4), (low quality:1.4), (extra digits:1.3),
(bad hands:1.3), watermark, text
```
### FLUX — minimal negative
```python
# FLUX.1 [dev] 매 distilled — CFG ≈ 1, negative prompt 효과 ↓
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16).to("cuda")
img = pipe(
prompt="cinematic portrait, golden hour, shallow DOF",
guidance_scale=3.5, # FLUX-specific
num_inference_steps=28,
).images[0]
# 매 negative prompt 매 관습 의 대신 — positive prompt 의 specificity 의 의존
```
### Region-specific negative (regional prompter)
```python
# 매 ComfyUI / Forge — mask 별 negative
region_prompts = [
{"mask": face_mask, "neg": "deformed, extra eye, asymmetric"},
{"mask": hand_mask, "neg": "extra fingers, fused fingers, mutated"},
]
```
### Artifact debug — A/B isolate
```python
# 매 baseline (no negative)
img_base = pipe(prompt=p, negative_prompt="", seed=42).images[0]
# 매 add one term at a time
for term in ["deformed", "extra fingers", "lowres", "watermark"]:
img = pipe(prompt=p, negative_prompt=term, seed=42).images[0]
img.save(f"debug_{term}.png")
# 매 비교 의 어떤 term 의 효과 의 식별
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Hand artifact | `(bad hands:1.3), extra fingers, fused fingers` |
| Watermark/text | `watermark, signature, text, logo` (high weight) |
| Style leak (cartoon) | `(cartoon:1.4), (anime:1.4)` |
| FLUX/SD3.5 사용 | negative prompt 의 minimal — positive 의 specificity ↑ |
| Inpaint 의 fix | mask region 의 local negative |
**기본값**: SDXL → standard negative bundle + weighting; FLUX → positive prompt 의 specificity.
## 🔗 Graph
- 부모: [[AI 이미지 생성 (AI Image Generation)]] · [[Diffusion Models]]
- 변형: [[Classifier-Free Guidance]] · [[Prompt Weighting]]
- 응용: [[AI 이미지 품질 최적화 및 디버깅 (Image Quality Optimization & Debugging)]] · [[미드저니 및 스테이블 디퓨전의 부분 편집 기법]]
- Adjacent: [[ControlNet]] · [[IP-Adapter]]
## 🤖 LLM 활용
**언제**: anatomy/composition artifact 추적, prompt A/B isolate, style leak 차단.
**언제 X**: FLUX-class distilled model — negative prompt 효과 ↓, positive specificity 의 의존.
## ❌ 안티패턴
- **Negative prompt 200-token wall**: token budget 낭비, 효과 saturate.
- **High weight (>1.5)**: 매 collapse — output 의 distort.
- **Generic "ugly, bad"**: 매 의미 없음 — concrete artifact name 의 사용.
- **FLUX 의 SDXL-style negative**: 매 non-effect — guidance distilled.
- **Seed 변경 의 비교**: 매 무의미 — same seed 만 isolate.
## 🧪 검증 / 중복
- Verified (Diffusers docs, compel library, AUTOMATIC1111 wiki, FLUX.1 model card 2024-2026).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — negative prompt + weighting, FLUX 차이 |