문서에 답이 없으면 거절하고, 두 종류의 오류를 모두 측정한다
읽는 데 약 35분분 걸린다, 6절에 3개 예제이(가) 있음.
AI로 번역함. 영어 원문을 사람이 검증함. 우리가 책을 만드는 방식
영어판 2026.11.3판을 번역한 것이다. 원문 읽기
이 장을 마치면 어시스턴트가 문서를 근거로 답하지 못하는 두 가지 경우를 각각 셀 수 있고, 두 비율을 각자의 분모에 비추어 읽을 수 있으며, 더 자주 거절하는 규칙이 그 비용만큼의 값어치가 있는 때가 언제인지 말할 수 있다.
이 책의 어시스턴트는 sablefile에 관한 질문에 답한다. sablefile은 프로젝트에서 생성된 파일이 그 파일의 원본 템플릿과 어긋나지 않도록 맞춰 주는 명령줄 도구이며, 어시스턴트는 이 도구의 문서를 근거로 답한다. 문서가 질문을 다루지 않을 때 어시스턴트는 고정된 한 문장, "The docs don't say."로만 답하도록 되어 있다. 이 문장은 안전한 답처럼 보인다. 로그에서 틀린 답을 본 팀은 어시스턴트가 더 자주 거절하게 만들고 싶어지는데, 거절은 신중해 보이기 때문이다. 그러나 거절도 틀릴 수 있다. 문서가 질문에 답하고 있었는데 사용자가 그 문장을 받았다면 그 사용자는 도움을 받지 못한 것이며, 어디에도 오류로 드러나지 않는다. 반대로 문서에 답이 없는데도 어시스턴트가 답했다면 사용자는 아무 근거 없는 답을 받은 것이다. 더 자주 거절한다는 것은 두 오류 중 하나를 다른 하나와 맞바꾸는 일이다. 둘 중 하나만 세는 팀은 보기 좋은 수치를 향해 조정하게 되고, 다른 쪽 오류의 비용은 가려진다.
이 장은 이 책 자체의 답변을 대상으로 두 오류를 모두 센다. 이어서 가장 먼저 떠오르는 해결책, 즉 최상위 절의 검색 점수가 낮으면 거절하는 가드를 필터링하지 않은 변형에서 시험한다. 이 변형에서 가드는 도움이 되지 않는다. 이것이 이 장의 결과이며, 이후의 내용은 대부분 이 결과를 어떻게 측정했는지, 그리고 얼마나 신뢰할 수 있는지를 다룬다.
이 부분은 아직 번역되지 않았으므로 영어로 표시된다.
Two errors, both counted
Every question in the test set has a kind. An answerable question is one that the docs of the asked version answer. An unanswerable question is one they don't. A reply that declines an answerable question makes a false refusal, and a reply that answers an unanswerable question makes a false answer. The first chapter defined both in its decline check, and this chapter uses the same definitions on more items.
The two rates have different denominators, and the denominators carry the point. The false refusal rate is the number of answerable items declined, over the number of answerable items. The false answer rate is the number of unanswerable items answered, over the number of unanswerable items. Put both errors over one total, and a set with many answerable items makes the refusal count look small, while the answers that should have been declines get lost in the sum. Each rate needs its own count, and each count needs its own denominator.
Two kinds of item stay out of both rates. A version-dependent item asks about something that differs between versions, so its reply is judged against the reference for the asked version, and its own rate, version-correctness, is covered in chapter 9. An ambiguous item has two readings and is judged by the pass rate, not by either decline rate. A decline on either kind is not an error here. The code still counts those declines and prints them, so a decline on one of them can't go unnoticed.
The code counts a reply as a decline only when the reply is the decline sentence and nothing more. A reply that gives the sentence and then an answer is not a decline, so it counts as an answer in both rates. The same holds for a refusal in other words: the code matches the sentence exactly, so a refusal worded differently counts as an answer. On an answerable item that is not an error here, and on an unanswerable item it is a false answer, which is why the sentence is fixed in the prompt.
Working rule: Report the two decline rates apart, each over its own denominator, and leave version-dependent and ambiguous items out of both. Read the items behind each rate, not only the rate, because a rate can hide the few items that matter.
베이스라인이 하는 일
베이스라인은 첫 번째 장에서 만든 그대로의 어시스턴트다. 이 어시스턴트는 모든 진술에 인용을 요구하고, 절에 근거가 없으면 거절 문장을 쓰라고 요구하는 프롬프트 P1을 실행한다. 검색은 BM25로 상위 세 개 절을 가져오며, 질문에서 지정한 버전의 색인만 대상으로 삼는다. 응답은 항목마다 한 번씩 기록되었고, 예제는 그 기록된 응답 하나를 읽는다.
세 가지 변형은 각각 한 가지만 바꾼다. prompt-b은 답을 내기 전에 그 답이 근거로 삼는 문장을 먼저 인용하게 하는 프롬프트 P2를 실행한다. k5는 모델에 절을 세 개가 아니라 다섯 개 준다. unfiltered은 모든 버전의 색인에서 함께 검색하고 각 절의 머리말에 버전을 적어, 모델이 다른 버전에서 온 절을 알아볼 수 있게 한다. 각 변형은 같은 항목에 대한 자기만의 응답 기록을 가지므로, 모든 비교는 같은 질문에 대한 응답끼리의 비교다.
각 기록에서 두 가지 오류를 세는 일은 예제 하나, decline-rates가 맡는다. 이 예제는 네 개의 기록을 dev 분할과 보류(held-out) 분할에서 모두 읽고, 각 비율을 건수와 함께 출력하며, 각 오류에 해당하는 항목의 이름을 밝힌다. 출력을 보면 각 기록이 거절한 답변 가능 항목과 답한 답변 불가능 항목이 무엇인지 알 수 있다.
1"""Counts the two decline errors for each recording, on dev and on held-out: answerable items declined (false refusals)2and unanswerable items answered (false answers). Each rate line rests on its own count and denominator.34Version-dependent and ambiguous items are left out of both rates; the last line per split counts the declines among5them, which are not errors here."""6import lib # first: fixes the thread counts and seeds before anything else loads78from lib.contract import parse_reply9from lib.prompts import P1_SHA256, P2_SHA25610from lib.replay import ReplayModel11from lib.stats import pct12from lib.testset import load_items1314VARIANTS = ( # label, recording, the sha256 of the prompt it was made from15 ("baseline", "assistant-baseline", P1_SHA256), # P1, k=3, filtered to the asked version16 ("unfiltered", "assistant-unfiltered", P1_SHA256), # P1, k=3, sections from every version17 ("prompt-b", "assistant-prompt-b", P2_SHA256), # P2, k=3, filtered18 ("k5", "assistant-k5", P1_SHA256), # P1, k=5, filtered19)2021for label, recording, prompt_sha256 in VARIANTS:22 model = ReplayModel(recording, prompt_sha256) # refuses a recording made from another prompt23 for split in ("dev", "held-out"):24 items = load_items(split=split)25 declined = {item.id: parse_reply(model.reply(item.id, 0)).declined for item in items} # sample 0 only26 answerable = [item for item in items if item.kind == "answerable"]27 unanswerable = [item for item in items if item.kind == "unanswerable"]28 refused = sorted(item.id for item in answerable if declined[item.id])29 answered = sorted(item.id for item in unanswerable if not declined[item.id])30 other_kinds = ("version-dependent", "ambiguous")31 other = [item.id for item in items if item.kind in other_kinds and declined[item.id]]32 print(f"{label} {split} false refusal rate (answerable declined): {pct(len(refused), len(answerable))}")33 print(f"{label} {split} false refusals: {', '.join(refused) or 'none'}")34 print(f"{label} {split} false answer rate (unanswerable answered): {pct(len(answered), len(unanswerable))}")35 print(f"{label} {split} false answers: {', '.join(answered) or 'none'}")36 for item_id in answered: # what each false answer cites, and its text, so the chapter's claims can be checked37 reply = parse_reply(model.reply(item_id, 0))38 print(f"{label} {split} reply to {item_id} cites: {', '.join(reply.citations) or 'none'}")39 print(f"{label} {split} reply to {item_id} text: {reply.text}")40 print(f"{label} {split} declined, not counted (version-dependent and ambiguous): {len(other)}")
python decline-rates.pybaseline dev false refusal rate (answerable declined): 10.0% (4 of 40)
baseline dev false refusals: q-0052, q-0060, q-0063, q-0079
baseline dev false answer rate (unanswerable answered): 0.0% (0 of 13)
baseline dev false answers: none
baseline dev declined, not counted (version-dependent and ambiguous): 6
baseline held-out false refusal rate (answerable declined): 30.0% (6 of 20)
baseline held-out false refusals: q-0101, q-0102, q-0103, q-0105, q-0111, q-0118
baseline held-out false answer rate (unanswerable answered): 0.0% (0 of 7)
baseline held-out false answers: none
baseline held-out declined, not counted (version-dependent and ambiguous): 2
unfiltered dev false refusal rate (answerable declined): 12.5% (5 of 40)
unfiltered dev false refusals: q-0005, q-0052, q-0058, q-0060, q-0079
unfiltered dev false answer rate (unanswerable answered): 15.4% (2 of 13)
unfiltered dev false answers: q-0018, q-0039
unfiltered dev reply to q-0018 cites: remote-retries
unfiltered dev reply to q-0018 text: Yes, sablefile 1.1 can fetch a remote template from a private URL that needs a login token, as long as the token is included in the request. The retry behavior for such fetches is up to 5 times before giving up, and this applies to `sync` and `diff` operations [sec:remote-retries]. The `check` command does not fetch anything and thus does not apply to such scenarios.
unfiltered dev reply to q-0039 cites: check-exit-status
unfiltered dev reply to q-0039 text: When check finds a drifted file, it prints `DRIFT` and the path, and exits with status 1. [sec:check-exit-status]
unfiltered dev declined, not counted (version-dependent and ambiguous): 9
unfiltered held-out false refusal rate (answerable declined): 45.0% (9 of 20)
unfiltered held-out false refusals: q-0101, q-0102, q-0103, q-0105, q-0106, q-0111, q-0115, q-0116, q-0117
unfiltered held-out false answer rate (unanswerable answered): 0.0% (0 of 7)
unfiltered held-out false answers: none
unfiltered held-out declined, not counted (version-dependent and ambiguous): 3
prompt-b dev false refusal rate (answerable declined): 7.5% (3 of 40)
prompt-b dev false refusals: q-0052, q-0063, q-0079
prompt-b dev false answer rate (unanswerable answered): 0.0% (0 of 13)
prompt-b dev false answers: none
prompt-b dev declined, not counted (version-dependent and ambiguous): 4
prompt-b held-out false refusal rate (answerable declined): 25.0% (5 of 20)
prompt-b held-out false refusals: q-0101, q-0102, q-0103, q-0105, q-0111
prompt-b held-out false answer rate (unanswerable answered): 0.0% (0 of 7)
prompt-b held-out false answers: none
prompt-b held-out declined, not counted (version-dependent and ambiguous): 0
k5 dev false refusal rate (answerable declined): 7.5% (3 of 40)
k5 dev false refusals: q-0052, q-0062, q-0079
k5 dev false answer rate (unanswerable answered): 0.0% (0 of 13)
k5 dev false answers: none
k5 dev declined, not counted (version-dependent and ambiguous): 5
k5 held-out false refusal rate (answerable declined): 30.0% (6 of 20)
k5 held-out false refusals: q-0102, q-0103, q-0105, q-0106, q-0111, q-0116
k5 held-out false answer rate (unanswerable answered): 0.0% (0 of 7)
k5 held-out false answers: none
k5 held-out declined, not counted (version-dependent and ambiguous): 2
베이스라인의 dev 거짓 거절률은 10.0% (4 of 40)이다. 거짓 거절은 q-0052, q-0060, q-0063, q-0079이며, 하나하나가 문서가 다루는 답변 가능 항목이다. 베이스라인의 dev 거짓 답변률은 0.0% (0 of 13)이므로, 답변 불가능한 dev 항목에는 하나도 답하지 않는다. 1장에서도 거짓 답변은 나오지 않았지만 답변 불가능 항목이 네 개뿐이어서 비율에 대해 말할 수 있는 바가 거의 없다. 베이스라인은 두 비율에서 모두 제외된 두 종류에 속하는 dev 항목도 6개 거절했다.
2장은 이 베이스라인의 과잉 거절을 10건으로 센다. 이 수치는 버전에 따라 답이 달라지는 항목을 포함해 문서가 답하는 모든 항목을 대상으로 하므로, 위의 거짓 거절과 함께 이 비율에서 제외된, 버전 의존 항목과 모호한 항목에 대한 거절도 담고 있다.
표는 네 개의 기록을 두 분할에서 나란히 보여 준다. 각 칸에는 비율과 건수가 들어 있다.
| 기록 | dev 거짓 거절 | dev 거짓 답변 | 보류 분할 거짓 거절 | 보류 분할 거짓 답변 |
|---|---|---|---|---|
| baseline | 10.0% (4 of 40) | 0.0% (0 of 13) | 30.0% (6 of 20) | 0.0% (0 of 7) |
| unfiltered | 12.5% (5 of 40) | 15.4% (2 of 13) | 45.0% (9 of 20) | 0.0% (0 of 7) |
| prompt-b | 7.5% (3 of 40) | 0.0% (0 of 13) | 25.0% (5 of 20) | 0.0% (0 of 7) |
| k5 | 7.5% (3 of 40) | 0.0% (0 of 13) | 30.0% (6 of 20) | 0.0% (0 of 7) |
unfiltered 행을 먼저 읽는다. dev에서 거짓 답변이 있는 행은 이 행뿐이기 때문이다. 이 행의 거짓 거절률은 12.5% (5 of 40)이고, 베이스라인은 10.0% (4 of 40)이다. unfiltered는 베이스라인이 답한 답변 가능 항목 두 개, q-0005와 q-0058을 거절하고, 베이스라인이 거절한 q-0063에는 답한다. 순차이는 40개 중 거절이 한 항목 더 많은 것이다. dev에서 베이스라인과 거절 수가 다른 경우는 모두 40개 중 한 항목 차이다. 이 항목들만으로는 어느 기록이 더 낫다고 결론 내릴 근거가 없으며, 이 정도 크기의 표본이 무엇을 보여 줄 수 있는지는 구간과 표본 크기에서 설명한다.
unfiltered 변형은 답변 불가능한 dev 항목 두 개에도 답하는데, 베이스라인은 하나도 답하지 않는다. 이 변형의 거짓 답변률은 15.4% (2 of 13)이다. 이는 구간이 없는 두 항목의 건수이므로, 이 장은 측정된 상승이 아니라 건수로 보고한다. 거짓 답변 두 건은 q-0018와 q-0039이다.
두 질문 모두 sablefile 1.1에 관한 것이고, 1.1 문서에는 두 답이 모두 없다. 하나는 원격 템플릿을 로그인 토큰으로 비공개 주소에서 가져올 수 있는지이고, 다른 하나는 diff가 차이를 발견했을 때 어떤 종료 상태를 반환하는지이다. 베이스라인은 둘 다 거절한다. unfiltered의 응답은 둘 다 답하며, 각각 인접한 절을 인용한다. q-0018에 대한 응답은 원격 가져오기의 재시도 규칙인 remote-retries을 인용한다. q-0039에 대한 응답은 check-exit-status을 인용하고 check의 종료 상태를 알려 주는데, 이는 질문이 묻는 diff와는 다른 명령이다. 예제는 각 인용과 각 응답의 본문을 출력하므로, 기록을 열어 보지 않고도 이 주장들을 확인할 수 있다. unfiltered 변형은 프롬프트가 아니라 검색을 바꾸므로, 가장 먼저 볼 곳은 인용이다.
dev의 거절을 반대 방향으로 움직이는 변형은 prompt-b와 k5이다. 둘 다 dev 거짓 거절이 베이스라인보다 하나 적고, 어느 쪽도 답변 불가능한 dev 항목에 답하지 않는다. prompt-b의 거짓 거절률은 7.5% (3 of 40)이다. k5는 7.5% (3 of 40)이다. 이 항목들에서 각각 베이스라인보다 하나 적을 뿐이며, 한 항목은 결론을 내릴 근거가 되지 않는다.
보류 분할 수치는 완전성을 위해 보고한다. prompt-b의 거짓 거절률은 25.0% (5 of 20)이다. k5의 거짓 거절률은 30.0% (6 of 20)이다. 베이스라인은 30.0% (6 of 20)이다. prompt-b와 베이스라인의 차이는 스무 항목 중 한 항목이며, 이 항목들에서는 결론을 내릴 근거가 되지 않는다. dev의 차이가 각각 한 항목뿐이므로 이 장에서는 어떤 변형도 선택하지 않는다.
작업 규칙: 프롬프트를 바꾸기 전에 dev 분할의 거짓 거절을 하나씩 직접 읽는다. 그중 하나가 문서의 실제 공백을 가리킬 수 있기 때문이다. 변형은 같은 항목에서 비교하고, 짝지은 구간은 예제가 출력한 경우에만 보고한다. 출력된 구간이 없으면 이 항목들에서의 건수를 보고하고, 어느 변형이 더 낫다는 결론은 내리지 않는다. 보류 분할은 dev에서 내린 선택을 확인하기 위해 한 번만 실행한다. unfiltered 변형은 여기서 경고의 사례다. dev에서 베이스라인이 거절하는 답변 불가능 항목에 답하기 때문이다. 이 장은 이를 구간 없이 보고하므로, 측정된 상승이 아니라 확인해 볼 이유로 읽어야 한다.
이 부분은 아직 번역되지 않았으므로 영어로 표시된다.
A guard on recorded replies
The guard rests on a plain idea. BM25 scores each section by the words it shares with the question. When the docs have nothing on a question, the best-matching section should share few words with it, so its score should be low. A guard reads the best-matching section's score and declines when it falls below a threshold. The idea is a hypothesis, and it can fail. A question may share many words with a section that doesn't answer it, and the sweep below is the test.
The guard can be measured without running the model again. Retrieval is deterministic: the same question gives the same top sections and the same scores each time. So the top score for every item can be computed from the index, and the guard becomes a rule applied to replies that have already been recorded. Its grid and rule are constants in lib/guard.py. The guard only turns answers into declines. It can never undo a decline, so it can lower false answers and can only raise false refusals.
The guard's score must come from the index that made the replies it judges, and the unfiltered replies were made from sections of every version. So the guard reads the unfiltered recording and takes the top BM25 score over the all-version index. A score from the asked version's index would be measured on sections the unfiltered model never saw. The guard is tested on the unfiltered variant because the baseline answers no unanswerable dev item, so a guard has nothing to remove there, while the unfiltered variant answers two. This chapter makes no claim about a guard on the baseline.
The grid runs from 0.00 to 10.00 in steps of a quarter, above every dev score. For each threshold the rule adds the two rates, each over its own denominator, and picks the threshold with the smallest sum. That equal weighting is a choice, and the too-many-and-too-few section returns to it. A tie goes to the lower threshold, because it changes fewer replies. The rule is stated in lib/guard.py and picks on dev. The held-out split is not untouched, since the first table in what the baseline does already shows its unguarded rates. The guard's held-out run came once, at the frozen threshold.
The sweep runs in tune-guard-dev, which prints both rates at every step of the grid and then the rule's pick. It opens with the check that matters most: the recorded sections of each item must match what the index returns, or the scores would describe a retrieval that never made the replies.
1"""Sweeps the decline guard's threshold over dev replies of the unfiltered recording, printing both rates at each2threshold, and the threshold the dev rule picks. The line for 0.00 is the recorded replies with no guard, since no top3score is below zero; the rule's pick rests on the rate lines below it. Only dev is read here."""4import lib # first: fixes the thread counts and seeds before anything else loads56from lib.guard import GRID, GUARD_RECORDING, RULE, contexts_match, denominators, errors, pick_threshold, rows7from lib.stats import pct89dev = rows("dev")10answerable, unanswerable = denominators(dev)11print(f"recording: {GUARD_RECORDING} (all versions, dev items)")12print(f"answerable dev items: {answerable}")13print(f"unanswerable dev items: {unanswerable}")1415mismatches = contexts_match("dev")16print(f"dev items whose recorded sections differ from the retrieval: {mismatches}")17assert mismatches == 0, "the scores come from a retrieval that did not make the recorded replies"18highest = max(row.score for row in dev)19print(f"highest top score on dev: {highest:.3f}")20assert highest < GRID[-1], "the grid must reach above every dev score"2122print(f"rule: {RULE}")23for threshold in GRID:24 refusals, answers = errors(dev, threshold)25 print(f"threshold {threshold:.2f}, false refusal rate: {pct(len(refusals), answerable)}")26 print(f"threshold {threshold:.2f}, false answer rate: {pct(len(answers), unanswerable)}")2728refusals, answers = errors(dev, 0.0)29print(f"recorded false refusals (no guard): {', '.join(refusals) or 'none'}")30print(f"recorded false answers (no guard): {', '.join(answers) or 'none'}")31scores = {row.item_id: row.score for row in dev}32for item_id in answers: # the top score of each recorded false answer, so a reader can see where it falls on the grid33 print(f"top score of recorded false answer {item_id}: {scores[item_id]:.3f}")3435chosen = pick_threshold(dev)36assert chosen == 0.0, f"the dev rule now picks {chosen:.2f}, not 0.00"37refusals, answers = errors(dev, chosen)38print(f"threshold chosen by the dev rule: {chosen:.2f}")39print(f"at the chosen threshold, false refusal rate: {pct(len(refusals), answerable)}")40print(f"at the chosen threshold, false answer rate: {pct(len(answers), unanswerable)}")
python tune-guard-dev.pyrecording: assistant-unfiltered (all versions, dev items)
answerable dev items: 40
unanswerable dev items: 13
dev items whose recorded sections differ from the retrieval: 0
highest top score on dev: 9.949
rule: pick the threshold in GRID whose false refusal rate plus false answer rate is smallest, each rate over its own denominator; when two thresholds tie, take the lower one
threshold 0.00, false refusal rate: 12.5% (5 of 40)
threshold 0.00, false answer rate: 15.4% (2 of 13)
threshold 0.25, false refusal rate: 12.5% (5 of 40)
threshold 0.25, false answer rate: 15.4% (2 of 13)
threshold 0.50, false refusal rate: 12.5% (5 of 40)
threshold 0.50, false answer rate: 15.4% (2 of 13)
threshold 0.75, false refusal rate: 12.5% (5 of 40)
threshold 0.75, false answer rate: 15.4% (2 of 13)
threshold 1.00, false refusal rate: 12.5% (5 of 40)
threshold 1.00, false answer rate: 15.4% (2 of 13)
threshold 1.25, false refusal rate: 12.5% (5 of 40)
threshold 1.25, false answer rate: 15.4% (2 of 13)
threshold 1.50, false refusal rate: 12.5% (5 of 40)
threshold 1.50, false answer rate: 15.4% (2 of 13)
threshold 1.75, false refusal rate: 12.5% (5 of 40)
threshold 1.75, false answer rate: 15.4% (2 of 13)
threshold 2.00, false refusal rate: 12.5% (5 of 40)
threshold 2.00, false answer rate: 15.4% (2 of 13)
threshold 2.25, false refusal rate: 15.0% (6 of 40)
threshold 2.25, false answer rate: 15.4% (2 of 13)
threshold 2.50, false refusal rate: 17.5% (7 of 40)
threshold 2.50, false answer rate: 15.4% (2 of 13)
threshold 2.75, false refusal rate: 17.5% (7 of 40)
threshold 2.75, false answer rate: 15.4% (2 of 13)
threshold 3.00, false refusal rate: 20.0% (8 of 40)
threshold 3.00, false answer rate: 15.4% (2 of 13)
threshold 3.25, false refusal rate: 30.0% (12 of 40)
threshold 3.25, false answer rate: 15.4% (2 of 13)
threshold 3.50, false refusal rate: 32.5% (13 of 40)
threshold 3.50, false answer rate: 15.4% (2 of 13)
threshold 3.75, false refusal rate: 37.5% (15 of 40)
threshold 3.75, false answer rate: 15.4% (2 of 13)
threshold 4.00, false refusal rate: 40.0% (16 of 40)
threshold 4.00, false answer rate: 7.7% (1 of 13)
threshold 4.25, false refusal rate: 45.0% (18 of 40)
threshold 4.25, false answer rate: 7.7% (1 of 13)
threshold 4.50, false refusal rate: 55.0% (22 of 40)
threshold 4.50, false answer rate: 7.7% (1 of 13)
threshold 4.75, false refusal rate: 60.0% (24 of 40)
threshold 4.75, false answer rate: 0.0% (0 of 13)
threshold 5.00, false refusal rate: 62.5% (25 of 40)
threshold 5.00, false answer rate: 0.0% (0 of 13)
threshold 5.25, false refusal rate: 70.0% (28 of 40)
threshold 5.25, false answer rate: 0.0% (0 of 13)
threshold 5.50, false refusal rate: 77.5% (31 of 40)
threshold 5.50, false answer rate: 0.0% (0 of 13)
threshold 5.75, false refusal rate: 77.5% (31 of 40)
threshold 5.75, false answer rate: 0.0% (0 of 13)
threshold 6.00, false refusal rate: 80.0% (32 of 40)
threshold 6.00, false answer rate: 0.0% (0 of 13)
threshold 6.25, false refusal rate: 82.5% (33 of 40)
threshold 6.25, false answer rate: 0.0% (0 of 13)
threshold 6.50, false refusal rate: 87.5% (35 of 40)
threshold 6.50, false answer rate: 0.0% (0 of 13)
threshold 6.75, false refusal rate: 87.5% (35 of 40)
threshold 6.75, false answer rate: 0.0% (0 of 13)
threshold 7.00, false refusal rate: 92.5% (37 of 40)
threshold 7.00, false answer rate: 0.0% (0 of 13)
threshold 7.25, false refusal rate: 92.5% (37 of 40)
threshold 7.25, false answer rate: 0.0% (0 of 13)
threshold 7.50, false refusal rate: 92.5% (37 of 40)
threshold 7.50, false answer rate: 0.0% (0 of 13)
threshold 7.75, false refusal rate: 92.5% (37 of 40)
threshold 7.75, false answer rate: 0.0% (0 of 13)
threshold 8.00, false refusal rate: 92.5% (37 of 40)
threshold 8.00, false answer rate: 0.0% (0 of 13)
threshold 8.25, false refusal rate: 95.0% (38 of 40)
threshold 8.25, false answer rate: 0.0% (0 of 13)
threshold 8.50, false refusal rate: 95.0% (38 of 40)
threshold 8.50, false answer rate: 0.0% (0 of 13)
threshold 8.75, false refusal rate: 95.0% (38 of 40)
threshold 8.75, false answer rate: 0.0% (0 of 13)
threshold 9.00, false refusal rate: 97.5% (39 of 40)
threshold 9.00, false answer rate: 0.0% (0 of 13)
threshold 9.25, false refusal rate: 97.5% (39 of 40)
threshold 9.25, false answer rate: 0.0% (0 of 13)
threshold 9.50, false refusal rate: 97.5% (39 of 40)
threshold 9.50, false answer rate: 0.0% (0 of 13)
threshold 9.75, false refusal rate: 97.5% (39 of 40)
threshold 9.75, false answer rate: 0.0% (0 of 13)
threshold 10.00, false refusal rate: 100.0% (40 of 40)
threshold 10.00, false answer rate: 0.0% (0 of 13)
recorded false refusals (no guard): q-0005, q-0052, q-0058, q-0060, q-0079
recorded false answers (no guard): q-0018, q-0039
top score of recorded false answer q-0018: 3.762
top score of recorded false answer q-0039: 4.592
threshold chosen by the dev rule: 0.00
at the chosen threshold, false refusal rate: 12.5% (5 of 40)
at the chosen threshold, false answer rate: 15.4% (2 of 13)
The check passes: zero dev items differ, and the example asserts that count is zero. The highest top score on dev is 9.949, which sits below the top of the grid.
Start at the bottom of the sweep. At 0.00 no score falls below the threshold, so the line shows the recorded replies with no guard. The false refusal rate there is 12.5% (5 of 40). The false answer rate is 15.4% (2 of 13). Every line up to 2.00 reads the same. At 2.25 the false refusals begin to rise, to 15.0% (6 of 40).
The false answers don't fall until 4.00, where the false answer rate is 7.7% (1 of 13). At 4.75 the false answer rate is 0.0% (0 of 13), so no unanswerable dev item is answered. The false refusal rate at 4.75 is 60.0% (24 of 40).
No line of the sweep lowers both rates below the no-guard line. Each threshold that lowers the false answers raises the false refusals, and each threshold that leaves the refusals alone leaves the answers alone. On dev, the guard makes a trade and no improvement.
The sweep also shows the limit of the score. The top score of q-0018 is 3.762, and the top score of q-0039 is 4.592. A threshold catches q-0018 only from 4.00 up, where the false refusal rate is already 40.0% (16 of 40). It catches q-0039 only from 4.75 up. No cut catches both answered items with fewer than half of the answerable items declined. The likely cause is the score itself: it counts shared words, and a section about the same command can share many words with a question that section doesn't answer. That is a reading of the sweep, not a measured fact. Testing it would mean scoring the items by hand, which this chapter does not do.
The rule's pick is 0.00. At that threshold the false refusal rate is 12.5% (5 of 40). The false answer rate is 15.4% (2 of 13). Both are the same as the recorded replies with no guard. The pick is a tie-break, not a finding. The lines from 0.00 to 2.00 have the same sum, and the rule takes the lowest of them, so the guard the rule chooses is no guard.
Working rule: Build a guard's scores from the same index that made the replies, and check that match before you read any rate. Then read the whole sweep with both rates on every line. A pick that ties with doing nothing says the rule found no reason to change a reply, and that is an answer worth keeping.
거절이 너무 많을 때와 너무 적을 때
스윕은 팀이 가드를 도입했을 때 마주할 상충 관계를 보여 주며, 측정 지표를 무엇으로 고르느냐에 따라 각각 어떤 결과가 보고되는지도 보여 준다. 어떤 팀이 오답만 센다고 가정하자. dev에서 모든 오답을 막는 가장 낮은 임계값은 4.75이므로, 이 팀은 4.75를 고르고 어시스턴트가 근거를 댈 수 없는 질문에는 더 이상 답하지 않는다고 보고할 것이다. 스윕의 4.75 행은 이 보고가 가리는 대가를 보여 준다. 4.75에서 거짓 거절률은 60.0% (24 of 40)이다. 이 팀은 다른 쪽 오류를 세지 않았으므로 보고서 어디에도 그 사실이 나오지 않는다.
실제 운영에서 주시해야 할 실패가 바로 이것이다. 문서에 답이 있는 질문을 한 사용자가 거절 문장을 받게 되며, 응답에는 그 문장이 틀렸다는 표시가 전혀 없다. 비용이 드러나는 곳은 거짓 거절 횟수뿐이다. 이를 세지 않는 팀은 오답이 0이라는 숫자만 읽고 배포한다.
이 규칙은 두 오류에 같은 가중치를 두는데, 이는 팀이 내려야 할 선택이다. 팀은 오답이 거짓 거절보다 훨씬 큰 비용을 치른다고 판단할 수 있다. 확신에 찬 오답이 사용자를 잘못된 해결책으로 이끄는 경우가 그 예이다. 그런 팀은 가중치가 합계를 움직일 만큼 커지면 dev에서 다른 임계값을 고르게 되며, 스윕은 그 방향을 보여 준다. 오답에 더 높은 가중치를 둘수록 선택은 더 많이 거절하는 임계값 쪽으로 밀린다. 이런 팀은 누가 스윕을 읽기 전에 자신의 가중치를 적어 두고, 그다음 그 가중치를 규칙에 넘겨야 한다. 이 장에서는 다른 가중치로 규칙을 다시 실행하지 않으며, 그러기 위해 홀드아웃 분할을 다시 열지도 않는다. 홀드아웃 수치를 본 뒤에 가중치를 고르면 그 분할에서 두 번째 튜닝을 하는 셈이 된다.
임계값은 응답을 만들어 낸 어시스턴트에도 종속된다. 점수는 인덱스에 좌우되고, 인덱스는 섹션을 어떻게 나누었는지와 어떤 버전이 들어 있는지에 좌우된다. 이 중 무엇이든 바뀌면 점수가 달라지므로 dev에서 임계값을 다시 골라야 하고, 누구든 비율을 읽기 전에 예제의 첫 번째 검사를 다시 통과해야 한다.
작업 규칙: 임계값을 튜닝하기 전에 각 오류의 비용을 팀 자신의 기준으로 적고, 누구도 스윕을 읽기 전에 그 가중치를 규칙에 넘겨라.
독자가 받아들여야 할 것
홀드아웃 분할은 임계값을 0.00으로 고정한 채 한 번 실행했다. 이 실행은 guard-held-out이며, 먼저 dev 규칙(가드에서 설명한다)이 여전히 그 값을 고르는지 단언한다. 따라서 dev 데이터나 규칙이 바뀌면 홀드아웃 수치가 하나도 출력되기 전에 실행이 멈춘다.
1"""Applies the decline guard, with its threshold frozen from dev, to the held-out items of the unfiltered recording, and2prints both rates with 95% bootstrap intervals over items. The threshold is a constant chosen by tune-guard-dev's rule3on dev; the assert checks that the rule still picks it, so a change to the dev data or the rule fails here."""4import lib # first: fixes the thread counts and seeds before anything else loads56from lib.guard import denominators, errors, guarded, pick_threshold, rows7from lib.stats import bootstrap_mean, interval_pct, pct89# Picked on dev by tune-guard-dev (the rule in lib/guard.py), then frozen. Held-out is not used to change it.10FROZEN_THRESHOLD = 0.01112dev_pick = pick_threshold(rows("dev")) # reads dev only13assert dev_pick == FROZEN_THRESHOLD, f"the dev rule now picks {dev_pick:.2f}, not the frozen {FROZEN_THRESHOLD:.2f}"1415held = rows("held-out")16answerable, unanswerable = denominators(held)17refusals, answers = errors(held, FROZEN_THRESHOLD)18print(f"threshold (frozen from dev): {FROZEN_THRESHOLD:.2f}")19print(f"held-out answerable items: {answerable}")20print(f"held-out unanswerable items: {unanswerable}")21changed = [row.item_id for row in held if guarded(row, FROZEN_THRESHOLD) != row.declined]22print(f"held-out replies the guard changed to declines: {len(changed)} of {len(held)}")2324# One 0/1 flag per item: the bootstrap over these flags is the bootstrap of the rate, over items.25refused_flags = [float(guarded(row, FROZEN_THRESHOLD)) for row in held if row.kind == "answerable"]26answered_flags = [float(not guarded(row, FROZEN_THRESHOLD)) for row in held if row.kind == "unanswerable"]27assert len(refused_flags) == answerable and len(answered_flags) == unanswerable2829refusal_lo, refusal_hi = bootstrap_mean(refused_flags, level=0.95) # 2,000 resamples, seeded (lib/stats.py)30answer_lo, answer_hi = bootstrap_mean(answered_flags, level=0.95)31print(f"false refusal rate: {pct(len(refusals), answerable)} interval {interval_pct(refusal_lo, refusal_hi)}")32print(f"false refusals: {', '.join(refusals) or 'none'}")33print(f"false answer rate: {pct(len(answers), unanswerable)} interval {interval_pct(answer_lo, answer_hi)}")34print(f"false answers: {', '.join(answers) or 'none'}")
python guard-held-out.pythreshold (frozen from dev): 0.00
held-out answerable items: 20
held-out unanswerable items: 7
held-out replies the guard changed to declines: 0 of 27
false refusal rate: 45.0% (9 of 20) interval [25.0%, 70.0%]
false refusals: q-0101, q-0102, q-0103, q-0105, q-0106, q-0111, q-0115, q-0116, q-0117
false answer rate: 0.0% (0 of 7) interval [0.0%, 0.0%]
false answers: none
고정된 가드가 바꾸는 홀드아웃 응답은 0 of 27개이므로, 홀드아웃 출력은 가드가 없을 때의 기록된 출력과 같다. 홀드아웃 분할에서 거짓 거절률은 45.0% (9 of 20) interval [25.0%, 70.0%]이다. 거짓 응답률은 0.0% (0 of 7) interval [0.0%, 0.0%]이다.
거짓 거절률은 첫 번째 표의 필터링하지 않은 변형과 같고, 홀드아웃 실행은 핵심 사항에서 dev와 일치한다. 규칙이 고른 임계값에서는 가드가 아무것도 하지 않는다. 홀드아웃의 거짓 응답률만 본 팀은 0을 보고 어시스턴트가 근거를 댈 수 없는 질문에는 답하지 않는다고 결론지을 것이다. 오류는 거절에 있으며, 가드는 거절을 추가할 뿐이므로 어떤 임계값으로도 이를 없앨 수 없다.
홀드아웃의 거짓 응답률은 0.0% (0 of 7) interval [0.0%, 0.0%]이다.
출력된 구간에는 폭이 없다. 이 구간은 답할 수 없는 홀드아웃 항목 일곱 개를 재표집한다. 그중 잘못 답한 항목이 하나도 없으므로 모든 재표집에 오류가 없고, 부트스트랩은 변할 수 없다. 충실성이 이처럼 사건이 0인 경우의 근거를 설명하며, 이 예제는 정확한 한계를 출력하지 않으므로 이 구간을 한계로 읽지 않는다. 이 구간으로는 거짓 응답률이 0인 경우와, 이 일곱 항목이 우연히 놓친 작은 비율을 구별할 수 없다. 항목 일곱 개가 보여 주는 것은 그중 어느 것도 잘못 답하지 않았다는 사실뿐이다.
dev 분할도 나을 것이 없다. dev에서 필터링하지 않은 응답은 가드가 없을 때 15.4% (2 of 13)을 낸다. 임계값 4.00에서는 7.7% (1 of 13)를 내며, 항목 하나가 줄어든다.
거짓 거절 구간이 넓은 이유는 다르다. 항목이 스무 개이면 데이터가 구별하지 못하는 비율의 범위가 남는다. 홀드아웃 수치는 45.0% (9 of 20) interval [25.0%, 70.0%]이다. 구간과 표본 크기는 이런 구간을 만드는 항목 단위 부트스트랩과, 쌍을 이룬 차이에 항목이 몇 개 필요한지를 설명한다. 코하비와 동료들은 웹의 통제된 실험에 대해 같은 점을 지적한다. 그들의 안내서 웹에서의 통제된 실험: 개관과 실무 지침은 검정력이 부족한 검정을 흔한 실수로 꼽는다. 항목 일곱 개의 홀드아웃 분할은 이렇게 작은 비율을 다루기에는 검정력이 부족하며, 이 장은 0이 확실성을 뜻하도록 두지 않고 그렇게 밝혀 둔다.
종합하면 결과는 구체적인 내용을 말해 준다. 필터링하지 않은 변형에서 dev 규칙이 고른 임계값일 때 가드는 어떤 응답도 바꾸지 않으므로, 이 장은 가드를 추가하지 않는다. dev의 필터링하지 않은 응답에는 두 오류가 모두 남아 있다. 홀드아웃에서는 거짓 거절이 비용이며, 이 장의 어떤 것도 이를 줄이지 못한다. 이 결과는 곧 하나의 결정이며, 측정이 뒷받침하는 결정이다.
이 장의 결정은 다음과 같다.
- 두 거절률은 각자의 분모에 대해 계산하여 모든 비교에 포함한다.
- 버전에 따라 달라지는 항목과 모호한 항목은 두 비율에서 모두 제외하고, 그 거절은 따로 센다.
- 거절 규칙은 가중치를 먼저 적어 두고 전체 스윕을 읽은 뒤 dev에서 고르며, 홀드아웃을 실행하기 전에 그 선택을 고정한다.
- 홀드아웃은 규칙마다 한 번 실행한다. 사건이 0인 구간은 0이라는 발견이 아니라 그 단서와 함께 보고한다.
- 검색 점수 가드는 필터링하지 않은 변형에 추가하지 않는다. dev에서 고른 값은 어떤 응답도 바꾸지 않고, 홀드아웃 실행도 바꾸지 않는다.
작업 규칙: 가드는 홀드아웃 실행에서 dev 스윕이 약속한 방향으로 응답이 바뀔 때에만 자리를 얻는다. 그렇지 않으면 그 결과를 그대로 남겨 둔다. 그 결과는 어시스턴트에게 어떤 오류가 있는지, 그리고 검색 점수의 임계값으로는 그 오류가 고쳐지지 않는다는 점을 보여 주기 때문이다.
이 책의 범위 밖
이 장은 공격을 다루지 않는다. 사용자가 어시스턴트에게 해서는 안 될 말을 하게 만들려는 시도는 고유한 위협과 방어 수단이 있는 보안 문제이며, 이를 위한 별도의 책 Securing LLM Applications and Agents가 계획되어 있다. 여기서 제시하는 거절률은 문서에 대한 정직한 질문을 측정한 값이며, 어시스턴트를 무너뜨리려는 사용자의 압박 아래에서 어시스턴트가 어떻게 행동하는지는 이 값으로 알 수 없다.
다른 연구자들은 다른 모델에서 같은 상충 관계를 측정했으며, 그들의 수치를 빌리지 않고도 그 주장은 알아 둘 만하다. XSTest는 안전하지 않아 보이는 안전한 프롬프트로 이루어진 테스트 모음이다. 저자들은 모델이 안전하지 않은 프롬프트와 비슷한 표현을 쓰거나 민감한 주제를 건드리는 안전한 프롬프트를 거절한다는 점 때문에 이를 만들었다(Röttger 외, 2024). ICML 2025에 발표된 OR-Bench는 여러 모델을 측정했고, 안전성 튜닝을 거친 모델이 얻은 추가적인 안전성에는 과잉 거절이 더 많이 따르는 경우가 흔했다고 보고한다(Cui 외, 2024). 언어 모델의 기권(abstention)에 대한 서베이는 모델이 답변을 거부하는 행위에 일반적인 이름을 붙이고, 기권을 질의, 모델, 인간의 가치라는 기준으로 정리한다(Wen 외, 2024). 2026년의 의료 분야 벤치마크는 자체 프롬프트 집합을 바탕으로 해당 분야에서 무해한 프롬프트에 대한 과잉 거절을 보고한다(Zhang 외, 2026).
이 논문들은 다른 모델을 다른 집합으로 시험하므로, 그 비율이 이 어시스턴트에 그대로 적용되지는 않는다. 적용되는 것은 그 논문들이 보여 주는 형태, 곧 이 장이 자체 사례로 검증하는 주장이다. 이 집합에서 가드는 답할 수 있는 항목을 더 많이 거절해야만 거짓 답변을 줄일 수 있으며, 이는 거짓 답변을 거짓 거절과 맞바꾸는 것이다. 프롬프트와 검색을 바꾸면 두 가지 오류를 모두 움직일 수 있고, 필터링하지 않은 변형이 실제로 그랬다. 이 장이 보고하는 결과는 이 책이 직접 수행한 실행의 결과뿐이다.
작업 규칙: 모델이 과잉 거절한다고 보고하는 논문이 있다는 이유로 거절 규칙을 도입하기 전에, 두 종류의 오류를 모두 세어 가며 자신의 어시스턴트와 자신의 항목으로 그 규칙을 측정한다. 논문의 수치는 자신의 결과에 넣지 않고, 측정의 계기가 된 아이디어에 대해서만 그 논문을 인용한다.
이 판의 이 장
2026.11.3판예제 통과 2026년 11월 21이 장에서 3개 예제개 중 3개가 통과한다
영어판 2026.11.3판을 번역한 것이다.