[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,71 +2,174 @@
|
||||
id: wiki-2026-0508-프롬프트-구문-prompt-syntax
|
||||
title: 프롬프트 구문 (Prompt Syntax)
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: []
|
||||
aliases: [Prompt Syntax, Prompt Grammar, 프롬프트 문법]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
tags: [uncategorized]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [prompt-engineering, syntax, image-generation, llm]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-08
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: text
|
||||
framework: Midjourney/SD/FLUX/Claude/GPT
|
||||
---
|
||||
|
||||
# [[프롬프트 구문 (Prompt Syntax)|프롬프트 구문 (Prompt Syntax)]]
|
||||
# 프롬프트 구문 (Prompt Syntax)
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
프롬프트 구문(Prompt Syntax)은 인공지능 이미지 생성 모델에게 사용자의 시각적 의도를 정확히 전달하기 위해 사용하는 명령어의 구조와 배열 규칙을 의미합니다 [1, 2]. 각 AI 모델(Midjourney, Stable Diffusion, DALL-E 등)은 고유한 아키텍처와 훈련 데이터를 가지므로, 사용자는 각 모델이 가장 잘 이해하는 특정 문법과 '방언'에 맞춰 프롬프트를 구성해야 합니다 [1, 3-5]. 효과적인 구문은 모호함을 줄이고 AI가 텍스트 기호를 정확한 픽셀 좌표로 변환할 수 있도록 돕습니다 [2].
|
||||
## 매 한 줄
|
||||
> **"매 model 마다 매 다른 매 grammar — 매 weight, 매 separator, 매 parameter, 매 negation 의 매 dialect"**. 매 Midjourney v7 의 매 `--ar 16:9 --style raw`, 매 SDXL 의 매 `(masterpiece:1.3)`, 매 FLUX 의 매 natural-language preference, 매 Claude/GPT 의 매 XML/Markdown structure — 매 같은 의도 의 매 prompt 가 매 model 마다 매 다른 매 wire-format 으로 매 표현 됨. 매 syntax 의 매 incorrect 사용 = 매 instruction 의 매 silent ignore.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
* **일반적인 프롬프트 계층 구조**
|
||||
가장 성공적이고 널리 쓰이는 프롬프트 구문은 보통 4~5개의 계층적 구조를 따릅니다. 일반적으로 `주제(Subject) + 맥락/환경(Context/Environment) + 스타일(Style/Medium) + 기술적 세부사항 및 매개변수(Technical Details/Parameters)`의 순서로 구성됩니다 [6-9]. 이러한 패턴화된 구조는 AI가 지시사항을 혼동하지 않도록 방지하며, 관련된 토큰(Tokens)들을 한데 묶어 배치함으로써 모델이 특정 요소를 누락하지 않고 반영할 확률을 높입니다 [10].
|
||||
## 매 핵심
|
||||
|
||||
* **플랫폼별 구문 특성과 차이점**
|
||||
* **미드저니(Midjourney):** 디스코드나 웹 인터페이스에서 `/imagine` 명령어로 시작하며, 선택적으로 이미지 URL을 넣고, 그 뒤에 텍스트 프롬프트를 작성합니다 [11]. 구문 맨 마지막에는 `--ar 16:9`, `--v 7`과 같은 매개변수(Parameters)를 추가하여 종횡비나 모델 버전을 제어합니다 [11-13]. 구두점을 매개변수에 포함해서는 안 되며, 텍스트와 대시(`--`) 사이에는 반드시 공백을 두어야 합니다 [14]. 또한 `{ }`를 사용해 여러 프롬프트를 한 번에 생성하는 순열(Permutations) 구문이나 `::`를 사용한 가중치 조절 문법을 지원합니다 [15].
|
||||
* **스테이블 디퓨전(Stable Diffusion):** 완전한 문장보다는 쉼표로 구분된 단어 태그(comma-separated tags)를 나열하는 구문이 효과적이며, 앞에 배치된 단어일수록 더 큰 영향을 미칩니다 [16]. `(단어:숫자)` 형식이나 `+`, `-` 기호를 붙여 특정 개념의 가중치를 미세하게 조절할 수 있습니다 [17-19]. 예를 들어 괄호 `()`는 해당 단어의 비중을 강화(1.1배)하고, 대괄호 `[]`는 비중을 약화하거나 부정적 프롬프트로 처리합니다 [16, 20].
|
||||
* **DALL-E 3:** 스테이블 디퓨전과 같은 키워드 나열 방식보다는 자연어 형태의 완전한 문장(full sentences)을 사용하는 구문이 훨씬 뛰어난 결과를 도출합니다 [21, 22]. 텍스트가 짧을 경우 GPT 모델이 스스로 프롬프트를 길게 확장하여 전달하므로, 이를 방지하려면 "프롬프트를 변경하지 말고 그대로 사용할 것"이라는 구문을 명시적으로 추가해야 합니다 [22, 23].
|
||||
### 매 image model syntax
|
||||
- **Midjourney v7**: 매 comma-separated tag, 매 `--param value`, 매 `::weight` (multi-prompt), 매 `--no` (negative).
|
||||
- **SDXL / Pony / Illustrious**: 매 comma tag, 매 `(token:1.3)` (weight), 매 `[token]` (LoRA), 매 negative prompt 분리.
|
||||
- **FLUX 1.2**: 매 natural language sentence 우선, 매 weight syntax 약함, 매 detail-rich prose.
|
||||
- **DALL-E 3 / GPT Image**: 매 natural language 만, 매 weight 부재.
|
||||
|
||||
* **토큰(Tokens)과 순서의 중요성**
|
||||
AI는 프롬프트의 단어를 인간처럼 이해하는 것이 아니라 '토크나이저(Tokenizer)'를 통해 숫자 형태의 토큰으로 분해하여 인식합니다 [24]. 따라서 단어의 순서는 결과물에 큰 영향을 미치며(앞에 올수록 중요도가 높음), 복잡한 단어는 여러 개의 토큰으로 쪼개질 수도 있습니다 [16, 23, 25].
|
||||
### 매 LLM syntax
|
||||
- **Claude Opus 4.7**: 매 XML tag (`<context>`, `<task>`), 매 system prompt, 매 chain-of-thought.
|
||||
- **GPT-5**: 매 markdown heading + 매 numbered list, 매 system role.
|
||||
- **Llama 3.x / Mistral**: 매 chat template (`[INST]...[/INST]`).
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** [[매개변수 (Parameters)|매개변수 (Parameters)]], [[가중치 조절 (Prompt Weights)|가중치 조절 (Prompt Weights)]], [[부정 프롬프트 (Negative Prompts)|부정 프롬프트 (Negative Prompts)]]
|
||||
- **Projects/Contexts:** 플랫폼별 프롬프트 최적화 작업 (Midjourney, DALL-E 3, Stable Diffusion)
|
||||
- **Contradictions/Notes:** 이미지 생성 모델 간에는 권장되는 프롬프트 구문 방식에 뚜렷한 차이가 있습니다. 스테이블 디퓨전은 쉼표로 분리된 키워드 태그 구문과 괄호를 활용한 가중치 문법을 선호하는 반면, DALL-E 3는 자연어 기반의 서술형 문장을 사용할 때 모델의 성능이 가장 잘 발휘됩니다 [16, 21, 22].
|
||||
### 매 응용
|
||||
1. 매 cross-model prompt translation.
|
||||
2. 매 production prompt template.
|
||||
3. 매 fine-tuning data format.
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-30*
|
||||
## 💻 패턴
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### Pattern 1: 매 Midjourney v7
|
||||
```text
|
||||
cinematic portrait of weathered detective, 85mm, rim light, film noir
|
||||
--ar 4:5 --style raw --stylize 200 --v 7 --no blurry, lowres
|
||||
```
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### Pattern 2: 매 SDXL Weight & Negative
|
||||
```text
|
||||
positive: (masterpiece:1.2), best quality, 1girl, samurai armor,
|
||||
cherry blossom, (intricate detail:1.3), <lora:samurai_v2:0.8>
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
negative: (worst quality:1.4), low quality, blurry, deformed hands,
|
||||
extra fingers, watermark, signature
|
||||
```
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
### Pattern 3: 매 FLUX 1.2 (natural-language)
|
||||
```text
|
||||
A cinematic portrait of a weathered detective in a rain-soaked alley.
|
||||
Shot on 85mm lens with shallow depth of field. Rim light from a neon
|
||||
sign creates a halo effect on his silhouette. Photorealistic, film grain.
|
||||
```
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
### Pattern 4: 매 Claude Opus 4.7 (XML structure)
|
||||
```xml
|
||||
<role>You are an expert TypeScript reviewer.</role>
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
<context>
|
||||
The codebase uses React 19 + TanStack Query.
|
||||
</context>
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
<task>
|
||||
Review the diff below for correctness, performance, and idiomatic React.
|
||||
</task>
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
<diff>
|
||||
{{DIFF}}
|
||||
</diff>
|
||||
|
||||
- **과거 데이터와의 충돌:** 없음
|
||||
- **정책 변화:** 없음
|
||||
<output_format>
|
||||
- Issues (severity, file:line, fix)
|
||||
- Approval verdict
|
||||
</output_format>
|
||||
```
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
### Pattern 5: 매 GPT-5 (markdown)
|
||||
```markdown
|
||||
# Role
|
||||
Expert SQL reviewer.
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
# Task
|
||||
Analyze the query for performance issues.
|
||||
|
||||
# Query
|
||||
```sql
|
||||
{{QUERY}}
|
||||
```
|
||||
|
||||
# Output
|
||||
1. Bottleneck (with EXPLAIN line ref)
|
||||
2. Suggested rewrite
|
||||
3. Estimated speedup
|
||||
```
|
||||
|
||||
### Pattern 6: 매 Llama 3.x Chat Template
|
||||
```text
|
||||
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
||||
|
||||
You are a helpful assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>
|
||||
|
||||
What is 2+2?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
||||
```
|
||||
|
||||
### Pattern 7: 매 Multi-prompt Weight (Midjourney)
|
||||
```text
|
||||
cyberpunk city ::2 watercolor ::1 --ar 16:9
|
||||
# 매 cyberpunk weight 2x watercolor — 매 blend ratio
|
||||
```
|
||||
|
||||
### Pattern 8: 매 Cross-model Translator (Python)
|
||||
```python
|
||||
def to_sdxl(mj_prompt: str) -> tuple[str, str]:
|
||||
"""매 Midjourney → SDXL (positive, negative)."""
|
||||
parts = mj_prompt.split('--no')
|
||||
positive = parts[0].strip().rstrip(',')
|
||||
negative = parts[1].strip() if len(parts) > 1 else ''
|
||||
# 매 strip MJ params
|
||||
import re
|
||||
positive = re.sub(r'--\w+\s+\S+', '', positive).strip()
|
||||
return positive, negative
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 모델 | Syntax 우선순위 |
|
||||
|---|---|
|
||||
| Midjourney v7 | comma tag + `--param` + `::weight` |
|
||||
| SDXL/Pony | `(token:weight)` + 매 negative 분리 |
|
||||
| FLUX 1.2 | natural-language prose |
|
||||
| DALL-E 3 / GPT Image | natural-language only |
|
||||
| Claude Opus 4.7 | XML + system role |
|
||||
| GPT-5 | markdown heading + role |
|
||||
| Llama / Mistral | chat template token |
|
||||
|
||||
**기본값**: 매 model 의 매 official docs 의 매 syntax 그대로 — 매 cross-paste 금지.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[프롬프트 엔지니어링]] · [[프롬프트 구조 및 문법 (Prompt Structure & Syntax)]]
|
||||
- 변형: [[프롬프트 가중치 및 부정 프롬프트 (Prompt Weights and Negative Prompts)]] · [[프롬프트 파라미터 제어 (Prompt Parameter Control)]]
|
||||
- 응용: [[조명 및 카메라 사양 지시(Lighting and Camera Specification)]] · [[스타일 및 캐릭터 참조 (Style and Character References)]]
|
||||
- Adjacent: [[자연어_프롬프트(Natural_Language_Prompt)]] · [[플랫폼별 프롬프트 최적화 (Platform-Specific Prompt Optimization)]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 cross-model prompt port, 매 production template, 매 fine-tune 의 매 data format, 매 syntax debugging.
|
||||
**언제 X**: 매 single-model 의 매 quick experiment — 매 그 model 의 매 natural style 만.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **매 syntax cross-paste**: SDXL `(weight:1.3)` 의 매 Midjourney 사용 — 매 silent ignore.
|
||||
- **매 negative 의 매 wrong placement**: SDXL 에서 매 positive 안 에 부정어 — 매 학습 효과 부재.
|
||||
- **매 Midjourney `--no` 의 매 SDXL 사용**: 매 ignored.
|
||||
- **매 weight 의 매 over-stack**: `(((token:1.5)))` — 매 blow-out artifact.
|
||||
- **매 LLM XML / markdown 의 매 image model 사용**: 매 의미 없음.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Midjourney v7 docs, ComfyUI/A1111 docs, FLUX guide, Anthropic prompt cookbook 2026, OpenAI prompt guide).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — model별 prompt syntax dialect 정리 |
|
||||
|
||||
Reference in New Issue
Block a user