OpenAI의 GPT 모범 사례: 전략6. 변경 사항을 체계적으로 테스트하기 / Strategy: Test changes systematically

시작하기 전에 - GPT 모범 사례 문서 개요

image

OpenAI의 GPT 모범 사례 문서는 GPT 모델로부터 더 나은 답변을 얻기 위한 6가지 전략(starategy)들과 함께 각 전략별 세부 전술들을 소개하고 있습니다.

이 게시글은 그 중 두번째 전략인 참고 문헌 제공하기 (Provide reference text) 를 소개하겠습니다. :smiley:

전체 GPT 모범 사례에 대한 설명이 궁금하신 분들께서는 아래 목차를 참고해주세요!

https://platform.openai.com/docs/guides/gpt-best-practices/gpt-best-practices


전략 6. 변경 사항을 체계적으로 테스트하기 / Strategy: Test changes systematically

때때로 새로운 명령어나 새로운 디자인과 같은 변경 사항이 시스템을 개선하는지 아니면 악화시키는지 구분하기 어려울 수 있습니다. 몇 가지 예시들을 보면서 어떠한 것이 더 나은지 힌트를 얻을 수 있지만, 샘플 크기가 작으면 진짜로 개선이 된건지 어쩌다 좋게 나온 것인지를 구분하기 어려울 수 있습니다. 또한, 어떤 입력에 대해서는 성능이 개선되었지만, 다른 입력에 대해서는 성능이 악화되었을 수도 있습니다.

Sometimes it can be hard to tell whether a change — e.g., a new instruction or a new design — makes your system better or worse. Looking at a few examples may hint at which is better, but with small sample sizes it can be hard to distinguish between a true improvement or random luck. Maybe the change helps performance on some inputs, but hurts performance on others.

평가 절차(또는 "평가(evals)")는 시스템 설계를 최적화하는데 유용합니다. 좋은 평가는 다음과 같습니다:

  • 실제 사용 사례를 대표해야 합니다. (또는, 적어도 다양하기라도 해야 합니다.)

  • 통계적으로 유의미하려면 많은 테스트 케이스를 포함해야 합니다. (아래 표를 참조하세요.)

  • 자동화하거나 반복하기 쉬워야 합니다.

감지해야 할 변화 95% 신뢰도를 위한 샘플 크기
30% ~10
10% ~100
3% ~1,000
1% ~10,000

Evaluation procedures (or "evals") are useful for optimizing system designs. Good evals are:

  • Representative of real-world usage (or at least diverse)
  • Contain many test cases for greater statistical power (see table below for guidelines)
  • Easy to automate or repeat
DIFFERENCE TO DETECT SAMPLE SIZE NEEDED FOR 95% CONFIDENCE
30% ~10
10% ~100
3% ~1,000
1% ~10,000

결과를 평가하는 일은 컴퓨터나 사람, 또는 혼합하여 수행할 수 있습니다. 컴퓨터는 객관적인 기준(예. 정답이 하나뿐인 질문)뿐만 아니라, 다른 모델의 쿼리를 통해 모델의 출력이 평가되는 주관적 또는 퍼지 기준을 사용하여 평가를 자동화할 수 있습니다. OpenAI의 평가(Evals)는 오픈소스 소프트웨어 프레임워크로, 평가를 자동화하는데 필요한 도구를 제공합니다.

Evaluation of outputs can be done by computers, humans, or a mix. Computers can automate evals with objective criteria (e.g., questions with single correct answers) as well as some subjective or fuzzy criteria, in which model outputs are evaluated by other model queries. OpenAI Evals is an open-source software framework that provides tools for creating automated evals.

모델 기반 평가는 품질이 동일하게 높을 것으로 간주되는 다양한 결과들이 존재할 때 유용할 수 있습니다(예: 질문의 답변이 긴 경우). 현실적으로 모델 기반 평가로 평가할 수 있는 것과 사람이 평가해야 하는 것 사이의 경계는 모호하며, 모델의 성능이 향상됨에 따라 지속적으로 변화하고 있습니다. 모델 기반 평가가 사용 사례에 얼마나 적합한지 알아내기 위해 별도의 실험을 할 것을 권장합니다.

Model-based evals can be useful when there exists a range of possible outputs that would be considered equally high in quality (e.g. for questions with long answers). The boundary between what can be realistically evaluated with a model-based eval and what requires a human to evaluate is fuzzy and is constantly shifting as models become more capable. We encourage experimentation to figure out how well model-based evals can work for your use case.

세부 전략: 모범 답안을 참조하여 모델의 결과를 평가하기 / Tactic: Evaluate model outputs with reference to gold-standard answers

질문에 대한 정답이 알려진 특정 사실들의 집합을 참조해야 한다고 가정해보겠습니다. 이럴 때 모델 질의를 사용하여 정답에 포함된 필수 사실들이 답변에 포함되어 있는지를 확인할 수 있습니다.

Suppose it is known that the correct answer to a question should make reference to a specific set of known facts. Then we can use a model query to count how many of the required facts are included in the answer.

예를 들어, 다음과 같은 시스템 메시지를 사용합니다:

For example, using the following system message:

시스템 메시지(SYSTEM)

질문에 대한 답변으로 추정되는 삼중 따옴표로 구분된 텍스트가 제공됩니다. 다음 정보가 답변에 직접 포함되어 있는지 확인하세요:
- 닐 암스트롱(Neil Armstrong)은 달에 최초로 발을 디딘 사람입니다.
- 닐 암스트롱이 달 위를 처음 걸은 날짜는 1969년 7월 21일입니다.

각 요점에 대해 다음 단계를 수행하십시오:
1 - 요점을 다시 서술합니다.
2 - 이 요점에 가장 가까운 답안에서 인용문을 제시합니다.
3 - 주제를 모르는 사람이 인용문을 읽는 경우 요점을 직접 유추할 수 있는지 고려합니다. 결정을 내리기 전에 그 이유 또는 그렇지 않은 이유를 설명합니다.
4 - 3번의 답이 예라면 "예"라고 쓰고, 그렇지 않으면 "아니오"라고 씁니다.

마지막으로, "예"라고 답한 사람의 수를 세어봅니다. 이 개수를 {"count": <여기에 카운트 삽입>} 형태로 입력합니다.

> You will be provided with text delimited by triple quotes that is supposed to be the answer to a question. Check if the following pieces of information are directly contained in the answer:
> - Neil Armstrong was the first person to walk on the moon.
> - The date Neil Armstrong first walked on the moon was July 21, 1969.
>
> For each of these points perform the following steps:
> 1 - Restate the point.
> 2 - Provide a citation from the answer which is closest to this point.
> 3 - Consider if someone reading the citation who doesn't know the topic could directly infer the point. Explain why or why not before making up your mind.
> 4 - Write "yes" if the answer to 3 was yes, otherwise write "no".
>
> Finally, provide a count of how many "yes" answers there are. Provide this count as {"count": <insert count here>}.

다음은 두 가지 요건을 모두 만족하는 입력 예시입니다:

Here's an example input where both points are satisfied:

시스템 메시지(SYSTEM)

<위 시스템 메시지를 입력하세요>
> <insert system message above>

사용자 메시지(USER)

"""닐 암스트롱은 인류 최초로 달에 발을 디딘 것으로 유명합니다. 이 역사적인 사건은 1969년 7월 21일 아폴로 11호 임무 중에 일어났습니다."""
> """Neil Armstrong is famous for being the first human to set foot on the Moon. This historic event took place on July 21, 1969, during the Apollo 11 mission."""

위 대화를 실행해보기 / Open in Playground

다음은 한가지만 만족하는 입력 예시입니다:

Here's an example input where only one point is satisfied:

시스템 메시지(SYSTEM)

<위 시스템 메시지를 입력하세요>
> <insert system message above>

사용자 메시지(USER)

"""닐 암스트롱은 달 모듈에서 내려 달을 걷는 최초의 사람이 되어 역사를 만들었습니다."""
> """Neil Armstrong made history when he stepped off the lunar module, becoming the first person to walk on the moon."""

위 대화를 실행해보기 / Open in Playground

다음은 어느 것도 만족하지 않는 입력 예시입니다:

Here's an example input where none are satisfied:

시스템 메시지(SYSTEM)

<위 시스템 메시지를 입력하세요>
> <insert system message above>

사용자 메시지(USER)

"""69년의 여름, 전설의 손길처럼 대담하게 아폴로 11호의 웅장한 항해가 시작되었습니다. 암스트롱이 그의 말처럼 새로운 세상을 향한 "작은 한 걸음"을 내딛자 역사가 펼쳐졌습니다."""
> """In the summer of '69, a voyage grand, Apollo 11, bold as legend's hand. Armstrong took a step, history unfurled, "One small step," he said, for a new world."""

위 대화를 실행해보기 / Open in Playground

이러한 유형의 모델 기반 평가에서는 여러 가지 변형이 가능합니다. 후보 답안과 모범 답안 간의 중복 유형을 추적하고 후보 답안이 모범 답안의 일부와 모순되는지 여부도 추적할 수 있는 다음 변형을 고려해 보겠습니다.

There are many possible variants on this type of model-based eval. Consider the following variation which tracks the kind of overlap between the candidate answer and the gold-standard answer, and also tracks whether the candidate answer contradicts any part of the gold-standard answer.

시스템 메시지(SYSTEM)

다음 단계들을 사용하여 사용자 입력에 응답합니다. 계속하기 전에 각 단계를 완전히 다시 설명합니다(예: "1단계: 이유...").

1단계: 전문가 답변과 비교하여 제출한 답변의 정보가 다음 중 어느 것인지에 대해 단계별로 이유를 설명합니다: 불일치(disjoint), 동일(equal), 부분 집합(subset), 상위 집합(superset) 또는 중복(overlapping) (예: 일부 교차하지만 부분 집합 / 상위 집합이 아님)
2단계: 제출한 답변이 전문가 답변의 어떤 측면과 모순되는지 단계별로 이유를 설명합니다.
3단계: 다음과 같이 구조화된 JSON 객체를 출력합니다: {"type_of_overlap": "disjoint(불일치)" 또는 "equal(같음)" 또는 "subset(부분 집합)" 또는 "superset(상위 집합)" 또는 "overlapping(겹침)", "contradiction(모순)": 참 또는 거짓}

> Use the following steps to respond to user inputs. Fully restate each step before proceeding. i.e. "Step 1: Reason...".
>
> Step 1: Reason step-by-step about whether the information in the submitted answer compared to the expert answer is either: disjoint, equal, a subset, a superset, or overlapping (i.e. some intersection but not subset/superset).
> Step 2: Reason step-by-step about whether the submitted answer contradicts any aspect of the expert answer.
> Step 3: Output a JSON object structured like: {"type_of_overlap": "disjoint" or "equal" or "subset" or "superset" or "overlapping", "contradiction": true or false}

다음은 전문가 답변과 모순되지 않는, 표준 이하의 답변이 포함된 입력 예제입니다:

Here's an example input with a substandard answer which nonetheless does not contradict the expert answer:

시스템 메시지(SYSTEM)

<위 시스템 메시지를 입력하세요>
> <insert system message above>

사용자 메시지(USER)

질문: """닐 암스트롱이 가장 유명한 사건은 무엇이며 언제 일어났나요? UTC 시간으로요."""
제출된 답변: """그가 달 위를 걷지 않았나요?"""
전문가 답변: """닐 암스트롱은 달에 최초로 발을 디딘 사람으로 가장 유명합니다. 이 역사적인 사건은 1969년 7월 21일에 일어났어요."""
> Question: """What event is Neil Armstrong most famous for and on what date did it occur? Assume UTC time."""
> Submitted Answer: """Didn't he walk on the moon or something?"""
> Expert Answer: """Neil Armstrong is most famous for being the first person to walk on the moon. This historic event occurred on July 21, 1969."""

위 대화를 실행해보기 / Open in Playground

다음은 전문가 답변과 직접적으로 모순되는 답변이 포함된 입력 예제입니다:

Here's an example input with answer that directly contradicts the expert answer:

시스템 메시지(SYSTEM)

<위 시스템 메시지를 입력하세요>
> <insert system message above>

사용자 메시지(USER)

질문: """닐 암스트롱이 가장 유명한 사건은 무엇이며 언제 일어났나요? UTC 시간으로요."""
제출된 답변: """1969년 7월 21일, 닐 암스트롱은 버즈 올드린에 이어 두 번째로 달 위를 걸은 사람이 되었습니다."""
전문가 답변: """닐 암스트롱은 달에 최초로 발을 디딘 사람으로 가장 유명합니다. 이 역사적인 사건은 1969년 7월 21일에 일어났습니다."""
> Question: """What event is Neil Armstrong most famous for and on what date did it occur? Assume UTC time."""
> Submitted Answer: """On the 21st of July 1969, Neil Armstrong became the second person to walk on the moon, following after Buzz Aldrin."""
> Expert Answer: """Neil Armstrong is most famous for being the first person to walk on the moon. This historic event occurred on July 21, 1969."""

위 대화를 실행해보기 / Open in Playground

다음은 필요한 것보다 조금 더 자세한 정보를 제공하는 정답이 포함된 입력 예제입니다:

Here's an example input with a correct answer that also provides a bit more detail than is necessary:

시스템 메시지(SYSTEM)

<위 시스템 메시지를 입력하세요>
> <insert system message above>

사용자 메시지(USER)

질문: """닐 암스트롱이 가장 유명한 사건은 무엇이며 언제 일어났나요? UTC 시간으로요."""
제출된 답변: """1969년 7월 21일 02:56(UTC)에 닐 암스트롱은 인류 최초로 달 표면에 발을 디디며 인류 역사에 기념비적인 업적을 남겼습니다."""
전문가 답변: """닐 암스트롱은 달에 발을 디딘 최초의 사람으로 가장 유명합니다. 이 역사적인 사건은 1969년 7월 21일에 일어났습니다."""

> Question: """What event is Neil Armstrong most famous for and on what date did it occur? Assume UTC time."""
> Submitted Answer: """At approximately 02:56 UTC on July 21st 1969, Neil Armstrong became the first human to set foot on the lunar surface, marking a monumental achievement in human history."""
> Expert Answer: """Neil Armstrong is most famous for being the first person to walk on the moon. This historic event occurred on July 21, 1969."""

위 대화를 실행해보기 / Open in Playground