---
id: wiki-2026-0508-자연어-프롬프트-natural-language-prompt
title: 자연어 프롬프트(Natural Language Prompt)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Natural Language Prompt, NL Prompt, Prompting]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [llm, prompt-engineering, nlp]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: Python / TypeScript
  framework: Anthropic SDK / OpenAI SDK
---

# 자연어 프롬프트(Natural Language Prompt)

## 매 한 줄
> **"매 model 의 입력 의 자연어 — 매 instruction 의 explicit, 매 context 의 sufficient, 매 format 의 specified."**. 매 GPT-3 (2020) 이후, 매 prompt 의 "new programming language" 화. 매 2026 의 modern era — Claude Opus 4.7, GPT-5, Gemini 2.5 — 의 1M context + system prompt + tool use 의 standard.

## 매 핵심

### 매 구성 요소
- **System prompt**: 매 persona, role, constraint 의 정의 (Claude/GPT 의 separate field).
- **Instruction**: 매 task 의 명시 — "Summarize", "Extract", "Translate".
- **Context**: 매 background, 매 input data, 매 example.
- **Format**: 매 output structure — JSON, markdown, XML tag.
- **Few-shot examples**: 매 input-output pair 의 demonstration.

### 매 technique
- **Zero-shot**: 매 example 의 없이 — 매 strong model 의 default.
- **Few-shot**: 매 2-5 example 의 inline — 매 format 의 anchor.
- **Chain-of-Thought (CoT)**: 매 "step by step" 의 reasoning 의 유도.
- **Self-consistency**: 매 multiple sample 의 majority vote.
- **ReAct**: 매 reasoning + tool action 의 interleave.

### 매 응용
1. **Code generation**: 매 spec → code (Cursor, Copilot).
2. **Document Q&A**: 매 long context 의 retrieval-augmented answer.
3. **Agent workflow**: 매 multi-step task 의 decomposition.

## 💻 패턴

### Claude API (system + few-shot)
```python
from anthropic import Anthropic

client = Anthropic()

response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=1024,
    system="You are a precise technical translator. Preserve code blocks verbatim.",
    messages=[
        {"role": "user", "content": "EN: Hello world\nKO:"},
        {"role": "assistant", "content": "안녕 세계"},
        {"role": "user", "content": "EN: The quick brown fox\nKO:"},
    ],
)
print(response.content[0].text)
```

### XML structure (Claude 의 권장)
```python
prompt = """
<task>Extract entities from the document.</task>

<document>
{document_text}
</document>

<format>
Return JSON: {"persons": [...], "organizations": [...], "locations": [...]}
</format>
"""
```

### Chain-of-Thought
```python
prompt = """
Question: A train leaves Seoul at 3pm at 80km/h. Another leaves Busan at 4pm at 100km/h. Distance is 400km. When do they meet?

Think step by step:
1. ...
2. ...

Final answer: ...
"""
```

### Tool use (function calling)
```python
tools = [{
    "name": "get_weather",
    "description": "Get current weather for a city",
    "input_schema": {
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"],
    },
}]

response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "What's the weather in Seoul?"}],
)
```

### Prompt caching (Claude)
```python
# 매 large system prompt 의 cache — 매 90% cost reduction
response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=1024,
    system=[
        {"type": "text", "text": LARGE_DOCUMENT, "cache_control": {"type": "ephemeral"}},
    ],
    messages=[{"role": "user", "content": "Summarize section 3."}],
)
```

### Structured output (JSON mode)
```python
# OpenAI 의 structured output
from pydantic import BaseModel
from openai import OpenAI

class Entity(BaseModel):
    name: str
    type: str

class Response(BaseModel):
    entities: list[Entity]

client = OpenAI()
result = client.beta.chat.completions.parse(
    model="gpt-5",
    messages=[{"role": "user", "content": "Extract entities from: 'Apple Inc. CEO Tim Cook visited Seoul.'"}],
    response_format=Response,
)
print(result.choices[0].message.parsed)
```

### Self-consistency
```python
# 매 5 sample 의 majority vote
samples = [client.messages.create(...).content[0].text for _ in range(5)]
from collections import Counter
answer = Counter(samples).most_common(1)[0][0]
```

### Prompt template (LangChain)
```python
from langchain_core.prompts import ChatPromptTemplate

prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a {role}."),
    ("human", "{input}"),
])
chain = prompt | llm
chain.invoke({"role": "translator", "input": "Hello"})
```

## 매 결정 기준
| 상황 | Approach |
|---|---|
| 매 simple task | Zero-shot |
| 매 format-strict | Few-shot + structured output |
| 매 reasoning | CoT + self-consistency |
| 매 long context | Prompt caching (Claude) |
| 매 multi-step | Tool use + agent loop |
| 매 production | Versioned prompts + eval set |

**기본값**: Claude Opus 4.7 + system prompt + XML structure + prompt caching.

## 🔗 Graph
- 부모: [[Prompt Engineering]] · [[LLM]]
- 변형: [[Few-shot Learning]] · [[Chain-of-Thought]] · [[ReAct]]
- 응용: [[Agent Workflow]] · [[RAG]] · [[Code Generation]]
- Adjacent: [[Structured Output]] · [[Tool Use]] · [[Prompt Caching]]

## 🤖 LLM 활용
**언제**: 매 prompt 의 iteration, 매 example 의 generation, 매 prompt 의 evaluation 의 brainstorm.
**언제 X**: 매 prompt 의 final production deploy — 매 human review + eval set 의 우선.

## ❌ 안티패턴
- **Vague instruction**: "Make it better" — 매 specific criterion 의 누락.
- **No format spec**: 매 output structure 의 unspecified — 매 parsing 의 brittle.
- **Mega-prompt**: 매 5000+ token instruction 의 overload — 매 model 의 confusion.
- **No few-shot for format**: 매 strict JSON 의 zero-shot — 매 schema drift 의 risk.
- **Prompt injection 의 미고려**: 매 user input 의 verbatim insertion — 매 jailbreak 의 risk.

## 🧪 검증 / 중복
- Verified (Anthropic Prompt Engineering docs, OpenAI cookbook, Wei et al. 2022 CoT).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — prompt 의 components + Claude/OpenAI patterns |
