할루시네이션 줄이기

할루시네이션 줄이기 (Reduce hallucinations)

Claude 같은 최첨단 언어 모델도 때로는 사실과 다르거나 주어진 맥락에 맞지 않는 텍스트를 만들어 낼 수 있어요. 이렇게 모델이 지어내는 현상을 "할루시네이션(hallucination)"이라고 부르는데, AI 기반 솔루션의 신뢰성을 떨어뜨릴 수 있죠. 이 가이드에서는 할루시네이션을 최소화하고 Claude의 출력을 정확하고 신뢰할 수 있게 만드는 기법들을 하나씩 소개해 드릴게요.

출처: 문서

본문

Claude 같은 가장 진보된 언어 모델조차 때때로 사실적으로 틀리거나 주어진 맥락과 일치하지 않는 텍스트를 생성할 수 있어요. "할루시네이션"이라고 알려진 이 현상은 여러분의 AI 기반 솔루션의 신뢰성을 떨어뜨릴 수 있어요. 이 가이드에서는 할루시네이션을 최소화하고 Claude의 출력이 정확하고 신뢰할 수 있게 하는 기법을 살펴볼 거예요.

기본적인 할루시네이션 최소화 전략

  • Claude가 "모르겠다"고 말하도록 허용하기: Claude에게 명시적으로 불확실함을 인정해도 좋다고 허락해 주세요. 이 간단한 기법만으로도 잘못된 정보를 크게 줄일 수 있어요.
```text User wrap As our M&A advisor, analyze this report on the potential acquisition of AcmeCo by ExampleCorp. {{REPORT}}

Focus on financial projections, integration risks, and regulatory hurdles. If you're unsure about any aspect or if the report lacks necessary information, say "I don't have enough information to confidently assess this."

</Accordion>

* **사실적 근거를 위해 직접 인용문 사용하기:** 긴 문서(20k 토큰 이상)가 관련된 작업에서는 작업을 수행하기 전에 Claude에게 단어 그대로의 인용문을 먼저 추출하라고 요청하세요. 이렇게 하면 응답이 실제 텍스트에 근거하게 되어 할루시네이션이 줄어들어요.

<Accordion title="예시: 데이터 프라이버시 정책 감사">
```text User wrap
As our Data Protection Officer, review this updated privacy policy for GDPR and CCPA compliance.
<policy>
{{POLICY}}
</policy>

1. Extract exact quotes from the policy that are most relevant to GDPR and CCPA compliance. If you can't find relevant quotes, state "No relevant quotes found."

2. Use the quotes to analyze the compliance of these policy sections, referencing the quotes by number. Only base your analysis on the extracted quotes.
  • 인용으로 검증하기: Claude의 각 주장에 대해 인용문과 출처를 인용하도록 함으로써 응답을 감사 가능하게 만들 수 있어요. 또한 Claude가 응답을 생성한 후 각 주장을 뒷받침하는 인용문을 찾아 검증하게 할 수도 있어요. 인용문을 찾지 못하면 그 주장을 철회해야 해요.
```text User wrap Draft a press release for our new cybersecurity product, AcmeSecurity Pro, using only information from these product briefs and market reports. {{DOCUMENTS}}

After drafting, review each claim in your press release. For each claim, find a direct quote from the documents that supports it. If you can't find a supporting quote for a claim, remove that claim from the press release and mark where it was removed with empty [] brackets.

</Accordion>

***

## 고급 기법

* **사고 사슬(Chain-of-thought) 검증:** 최종 답변을 내기 전에 Claude에게 추론 과정을 단계별로 설명하라고 요청하세요. 이렇게 하면 잘못된 논리나 가정을 드러낼 수 있어요.

* **Best-of-N 검증:** 같은 프롬프트로 Claude를 여러 번 실행하고 출력을 비교해 보세요. 출력 간의 불일치는 할루시네이션을 나타낼 수 있어요.

* **반복적 개선(Iterative refinement):** Claude의 출력을 후속 프롬프트의 입력으로 사용해 이전 진술을 검증하거나 확장하도록 요청하세요. 이렇게 하면 불일치를 잡아내고 고칠 수 있어요.

* **외부 지식 제한:** Claude에게 제공된 문서의 정보만 사용하고 일반 지식은 사용하지 말라고 명시적으로 지시하세요.

<Note>
기억하세요. 이러한 기법들은 할루시네이션을 크게 줄여주지만 완전히 없애지는 못해요. 특히 높은 위험이 따르는 결정에서는 중요한 정보를 항상 검증하세요.
</Note>

## 더 알아보기 (Learn more)

- [개발 테스트 (Develop tests)](https://platform.claude.com/docs/en/test-and-evaluate/develop-tests)
- [일관성 높이기 (Increase consistency)](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/increase-consistency)
- [프롬프트 누출 줄이기 (Reduce prompt leak)](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-prompt-leak)
- [프롬프팅 모범 사례](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices)