c24165b8bc
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
6.6 KiB
6.6 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-prompt-weight | Prompt Weight | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Prompt Weight
매 한 줄
"매 emphasize / de-emphasize specific tokens in a prompt —
(word:1.3)syntax of Stable Diffusion,--wof Midjourney, attention scaling under the hood". AUTOMATIC1111 (2022) 의 prompt-weight syntax 가 community standard 로 자리잡음. 2026 currently FLUX, SD3.5, SDXL Turbo, Midjourney v7 모두 weighting 지원; T5-encoded models 는 syntax 가 다름.
매 핵심
매 syntax (Stable Diffusion / A1111 / ComfyUI)
(word)— weight ×1.1.((word))— ×1.21.(word:1.3)— explicit weight ×1.3.[word]— weight ÷1.1.[word:0.5]— weight ×0.5.(red hair:1.4) (blue eyes:0.8)— phrase-level.
매 syntax (Midjourney v7)
cat dog— equal weight.cat::2 dog::1— double-colon multi-prompt with weights.--w 0.5— image weight (text vs reference image).--s 250— stylize strength.
매 syntax (FLUX / T5-encoded)
- T5 understands natural language;
(word:1.3)syntax 매 mostly ignored. - Use emphasis via wording: "very prominent X", "subtle hint of Y".
- Some forks (forge, ComfyUI) 매 still parse weights via re-prompting.
매 mechanism (under the hood)
- CLIP/T5 text encoder → token embeddings.
- A1111: weight w → multiply token embedding by w (post-encoding rescale).
- Compel library: more sophisticated — interpolates between conditioning vectors.
- Cross-attention scaling: alternative — scale K/V at attention layer.
매 best practices
- Stay between 0.5 and 1.5; 매 above 1.5 → distortion / saturation.
- Negative prompts often more effective than
[word]syntax. - Long prompts: weight the critical 3-5 tokens, leave rest at 1.0.
- For T5 models, use natural-language emphasis instead.
💻 패턴
diffusers + Compel (programmatic weighting)
from diffusers import StableDiffusionXLPipeline
from compel import Compel, ReturnedEmbeddingsType
import torch
pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16
).to("cuda")
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 (red:1.4) sports car on a (sunny:0.7) beach, cinematic"
conditioning, pooled = compel(prompt)
image = pipe(prompt_embeds=conditioning, pooled_prompt_embeds=pooled).images[0]
A1111-style parsing (manual)
import re
def parse_weighted(prompt):
"""Return list of (text, weight) tuples."""
out, depth_paren, depth_brack = [], 0, 0
# Simplified: handles (text:1.3) only
pattern = re.compile(r"\(([^():]+):([\d.]+)\)")
parts, last = [], 0
for m in pattern.finditer(prompt):
if m.start() > last:
parts.append((prompt[last:m.start()], 1.0))
parts.append((m.group(1), float(m.group(2))))
last = m.end()
if last < len(prompt):
parts.append((prompt[last:], 1.0))
return parts
Cross-attention scaling (Hugging Face)
# Scale a specific token's attention by factor
from diffusers.models.attention_processor import AttnProcessor
class WeightedAttn(AttnProcessor):
def __init__(self, token_idx, scale):
self.token_idx, self.scale = token_idx, scale
def __call__(self, attn, hidden, encoder_hidden, attention_mask=None):
# In encoder_hidden, multiply token_idx slot by scale before attn
encoder_hidden = encoder_hidden.clone()
encoder_hidden[:, self.token_idx] *= self.scale
return super().__call__(attn, hidden, encoder_hidden, attention_mask)
Midjourney prompt
masterpiece anime girl::3 cyberpunk city background::1 neon lights::0.5
--ar 16:9 --s 500 --v 7
FLUX-style natural-language emphasis (no syntax)
# Bad (FLUX ignores): "(red hair:1.5) girl"
# Good: "girl with strikingly vivid red hair, the red is the most prominent color in the image"
Prompt-blending (interpolate two prompts)
from compel import Compel
c1 = compel("a cat in a forest")
c2 = compel("a robot in a city")
mixed = (c1 + c2) / 2 # Compel supports tensor arithmetic
image = pipe(prompt_embeds=mixed).images[0]
Step-conditional weighting ([from:to:step])
[cat:dog:0.5] in a field
# 0-50% steps: "cat", 50-100%: "dog"
# Useful for changing subject mid-denoising
매 결정 기준
| 상황 | Approach |
|---|---|
| SDXL / SD1.5 / SD2.1 | A1111 (word:1.3) syntax via Compel |
| FLUX / SD3.5 (T5) | Natural-language emphasis |
| Midjourney v7 | ::weight syntax |
| Subject + style mix | Multi-prompt with :: or compel blends |
| Subtle adjustment | 0.8-1.2 range |
| Strong push | 1.3-1.5; rarely above |
| Suppress concept | Negative prompt (preferred) over [word] |
기본값: Compel for SDXL programmatic; A1111 syntax for casual; natural language for FLUX.
🔗 Graph
- 부모: Prompt_Engineering · AI 이미지 생성 (AI Image Generation)
- 변형: Negative Prompt
- 응용: Stable-Diffusion · FLUX · Midjourney · ComfyUI
- Adjacent: CLIP · Diffusion-Models · ControlNet
🤖 LLM 활용
언제: image generation pipelines, fine-grained subject/style control, automated prompt synthesis. 언제 X: text-only LLM prompts (GPT/Claude don't use this syntax — use emphasis words instead), T5-only models.
❌ 안티패턴
- Weight > 2.0: 매 saturated artifacts, deformed output.
- Stacking parens
(((((word))))): hard to read; use explicit(word:1.6). - A1111 syntax on FLUX/T5: silently ignored — switch to natural language.
- Weighting every token: dilutes effect; pick 2-4 priorities.
- Forgetting negative prompt: often the right tool for "not X".
🧪 검증 / 중복
- Verified (AUTOMATIC1111 wiki, Compel docs, Midjourney v7 docs 2024-2025, FLUX official guidance).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — canonical prompt-weight ref + FLUX/T5 caveat |