Files
2nd/10_Wiki/Topics/AI_and_ML/프롬프트 구문 (Prompt Syntax).md
T
2026-05-10 22:08:15 +09:00

176 lines
6.1 KiB
Markdown

---
id: wiki-2026-0508-프롬프트-구문-prompt-syntax
title: 프롬프트 구문 (Prompt Syntax)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Prompt Syntax, Prompt Grammar, 프롬프트 문법]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [prompt-engineering, syntax, image-generation, llm]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: text
framework: Midjourney/SD/FLUX/Claude/GPT
---
# 프롬프트 구문 (Prompt Syntax)
## 매 한 줄
> **"매 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.
## 매 핵심
### 매 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 부재.
### 매 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]`).
### 매 응용
1. 매 cross-model prompt translation.
2. 매 production prompt template.
3. 매 fine-tuning data format.
## 💻 패턴
### 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
```
### 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>
negative: (worst quality:1.4), low quality, blurry, deformed hands,
extra fingers, watermark, signature
```
### 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.
```
### Pattern 4: 매 Claude Opus 4.7 (XML structure)
```xml
<role>You are an expert TypeScript reviewer.</role>
<context>
The codebase uses React 19 + TanStack Query.
</context>
<task>
Review the diff below for correctness, performance, and idiomatic React.
</task>
<diff>
{{DIFF}}
</diff>
<output_format>
- Issues (severity, file:line, fix)
- Approval verdict
</output_format>
```
### Pattern 5: 매 GPT-5 (markdown)
```markdown
# Role
Expert SQL reviewer.
# 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 정리 |