평가를 CI에 넣고, 실제 트래픽에서 변형을 비교하기
읽는 데 약 31분분 걸린다, 5절에 4개 예제이(가) 있음.
AI로 번역함. 영어 원문을 사람이 검증함. 우리가 책을 만드는 방식
영어판 2026.11.3판을 번역한 것이다. 원문 읽기
이 장을 마치면 변경이 측정 가능하게 나빠졌을 때에만 그 변경을 막는 게이트에 평가를 넣을 수 있다. 또한 두 변형을 실제 트래픽에서 비교하면 무엇을 보여 줄 수 있고 무엇을 보여 줄 수 없는지도 설명할 수 있다.
sablefile 어시스턴트는 이 도구의 문서를 바탕으로 답하며, 팀은 프롬프트나 검색이나 모델을 매주 바꾼다. 팀은 변경이 병합되기 전에 어시스턴트가 나빠졌는지 알고 싶어 한다. 통과율이 조금이라도 떨어지면 실패하는 게이트는 안전한 선택처럼 보이지만 그렇지 않다. 개발 항목이 80개이면 항목 하나가 통과율을 약 1.3포인트 움직이므로, 원래의 통과율만 보는 게이트는 한두 항목의 차이에도 변경을 막게 된다. 잡음 때문에 막히는 팀은 게이트를 우회하는 법을 익히기 쉽고, 그러면 게이트는 아무것도 지켜 주지 못한다.
1장에서는 테스트 세트, 검사, 판정기, 재생한 답변까지 평가 전체를 처음으로 실행했다. 이 장은 그 실행을 그대로 유지한다. 먼저 신뢰구간을 고려하는 게이트, 표본마다 판정이 바뀌는 항목, 평가 자체 코드의 테스트라는 세 부분을 차례로 다룬다. 그다음 같은 부분들을 평가 프레임워크의 용어에 대응시키고, 마지막으로 실제 트래픽에서 변형을 비교하면 무엇을 보여 줄 수 있고 무엇을 보여 줄 수 없는지를 다룬다.
구간을 존중하는 게이트
게이트는 변경이 병합되지 못하도록 막는 규칙이다. 이 책에서 이 규칙은 하나의 수치에 근거한다. 같은 dev 항목에 대해 후보와 기준선 사이의 통과율 쌍체 차이이다. 비교는 8장이 정의하는 대로 쌍체 방식이다. 각 항목마다 후보의 판정에서 기준선의 판정을 뺀 값을 구하고, 이를 항목 전체에 대해 평균한다. 구간은 항목에 대한 부트스트랩으로 구한다. 두 실행이 같은 질문에 답하므로, 두 실행이 일치하는 항목은 차이에서 상쇄된다.
게이트의 규칙은 하나이다. 구간의 상한이 임계값의 음수보다 작을 때에만 실패한다. 상한은 데이터가 여전히 허용하는 가장 덜 음수인 값이므로, 데이터를 가장 낙관적으로 읽어도 임계값보다 큰 하락이 나타날 때 게이트가 실패한다. 단순한 게이트라면 차이의 점추정치가 임계값의 음수보다 작을 때마다 실패할 것이고, 그렇게 되면 잡음 때문에 실패하게 된다. 이 책의 규칙에는 대가가 있다. 데이터가 아직 증명하지 못하는 실제 하락 가운데 일부를 통과시킨다는 점이다. 그래서 통과는 다음 문단들에서 설명하듯 구간의 너비와 함께 읽어야 한다.
임계값은 5점이다. 예제의 주석에 따르면 이는 표준이 아니라 이 책을 위한 선택이다. dev 집합이 이 크기일 때 항목 하나는 약 1.3점이므로, 5점은 순 4개 항목에 해당한다.
첫 번째 실행은 이 판정기가 측정하기에 큰 하락이다. 두 번째 모델인 Qwen3-0.6B는 4B 기준선보다 작으며, 같은 dev 항목에 답했다. 판정기는 기준선 자신의 모델인 Qwen3-4B-Instruct-2507이므로, 이 격차만으로는 더 약한 어시스턴트 때문인지 자기 선호 때문인지 구분할 수 없다. 이 책이 왜 그것을 검증할 수 없는지는 자기 선호에서 설명한다. 결정은 구간에서 따라 나오는 것이므로 마지막에 읽는다.
1"""Runs the gate on second-model against the baseline over the eighty dev items: both pass rates with their counts, the paired2difference, its interval, the threshold and the decision. The gate fails only when the upper bound of the interval is below3minus the threshold, so a drop that the interval cannot rule out below the threshold does not fail it."""4import lib # first: fixes the thread counts and seeds before anything else loads56from lib.calibration import readable_verdicts7from lib.gate import FAIL, gate8from lib.judging import passed9from lib.prompts import REF_SHA25610from lib.stats import interval_points, pct11from lib.testset import load_items1213BASELINE = "judge-answers-baseline"14CANDIDATE = "judge-answers-second-model"15# Five points is this gate's threshold, chosen for the book, not a standard. With eighty dev items one item moves a rate16# by 1.25 points, so five points is four items net: a smaller threshold would ask the gate to see drops the interval17# cannot resolve at this size.18THRESHOLD_POINTS = 5.01920items = [item.id for item in load_items(split="dev")] # eighty dev items, sorted by id21baseline_found, baseline_unreadable = readable_verdicts(BASELINE, items, REF_SHA256)22candidate_found, candidate_unreadable = readable_verdicts(CANDIDATE, items, REF_SHA256)23for label, unreadable in (("baseline", baseline_unreadable), ("second-model", candidate_unreadable)):24 details = "".join(f' ({item_id}, "{first}")' for item_id, first in unreadable)25 print(f"unreadable verdicts, {label}: {len(unreadable)}{details}")26# An item the judge did not give a readable verdict on, under either run, is left out of both sides: a paired27# difference needs the same items under both runs.28excluded = {item_id for item_id, _ in baseline_unreadable + candidate_unreadable}29kept = [item_id for item_id in items if item_id not in excluded]30first = passed({item_id: baseline_found[item_id] for item_id in kept}) # 1.0 or 0.0 per item, in id order31second = passed({item_id: candidate_found[item_id] for item_id in kept})3233result = gate(first, second, threshold_points=THRESHOLD_POINTS)34print(f"dev items compared (n): {result.n}")35print(f"baseline pass rate: {pct(int(first.sum()), result.n)}")36print(f"second-model pass rate: {pct(int(second.sum()), result.n)}")37print(f"difference, second-model minus baseline: {100 * result.difference:+.1f} points")38print(f"{100 * result.level:.0f}% interval of the difference: {interval_points(result.lo, result.hi)}")39print(f"upper bound of the interval: {100 * result.hi:+.1f} points")40print(f"threshold: {THRESHOLD_POINTS:.1f} points")41if result.decision == FAIL:42 print(f"decision: fail, since the upper bound {100 * result.hi:+.1f} is below {-THRESHOLD_POINTS:+.1f}")43else:44 print(f"decision: pass, since the upper bound {100 * result.hi:+.1f} is not below {-THRESHOLD_POINTS:+.1f}")
python gate-real-drop.pyunreadable verdicts, baseline: 1 (q-0043, "VERDICT: PARTIAL")
unreadable verdicts, second-model: 0
dev items compared (n): 79
baseline pass rate: 78.5% (62 of 79)
second-model pass rate: 40.5% (32 of 79)
difference, second-model minus baseline: -38.0 points
95% interval of the difference: [-48.1, -26.6] points
upper bound of the interval: -26.6 points
threshold: 5.0 points
decision: fail, since the upper bound -26.6 is below -5.0
게이트는 실패하며, 그 이유는 점추정치가 아니라 구간에 있다. 기준선의 통과율은 78.5% (62 of 79)이다. 두 번째 모델의 통과율은 40.5% (32 of 79)이다.
비교 대상은 dev 항목 전부가 아니라 79개 항목이다. 기준선의 판정을 읽을 수 없었던 항목은 두 실행 모두에서 제외되기 때문이다. 쌍체 차이에는 두 실행 모두에서 같은 항목이 필요하다. 두 번째 모델에서 기준선을 뺀 차이는 -38.0 points이고, 그 95% 구간은 [-48.1, -26.6] points이다.
상한은 -26.6 points이고 임계값은 5.0 points이므로, 상한조차 임계값보다 한참 아래에 있다. 이 하락은 구간으로 설명해 버릴 수 있는 것이 아니며, 따라서 이 판정기가 측정하는 대로라면, 게이트는 이런 종류의 하락에서 실패하도록 만들어져 있다. 결정은 다음과 같다. fail, since the upper bound -26.6 is below -5.0.
더 작은 변경은 다른 결과를 낳는다. 변경이 통과율을 더 적게 떨어뜨리거나, 집합이 더 작아 구간이 넓어져서 상한이 임계값의 음수인 -5점 위로 올라간다고 하자. 그러면 게이트는 통과한다. 임계값보다 큰 하락을 찾지 못한 것일 뿐, 후보가 기준선만큼 좋다는 것을 보인 것은 아니다. 구간이 넓은 통과는 약한 통과이므로, 결정만이 아니라 구간의 너비도 읽어야 한다. 주어진 크기에서 구간이 얼마나 넓어지는지, 그리고 작은 쌍체 차이가 분명해지려면 항목이 몇 개 필요한지는 8장에서 다룬다.
게이트의 한계는 그 크기에 있다. 79개 항목에서는 게이트가 실패하려면 상한이 임계값의 음수보다 한참 아래로 내려가야 하므로, 작은 하락은 통과한다. 8장은 그 장이 가정하는 불일치 수준에서, 10점 차이를 검정력 80%로 보이는 데 79개 항목이면 충분하고 5점 차이에는 316개가 필요하다고 추정한다. 게이트는 그 검정력 계산보다 더 엄격한 검정이므로, 실제로 10점 하락이 있어도 통과할 수 있다. 임계값과 집합의 크기는 함께 정해야 한다.
일부 게이트는 두 개 이상의 지표를 검사한다. 지표가 하나 늘 때마다 잡음이 하락처럼 보일 기회가 하나 더 생기므로, 게이트는 비교 횟수를 반영한다. 지표가 m개이면 각 구간은 1에서 0.05를 m으로 나눈 값을 뺀 수준으로 구한다. 지표가 둘이면 97.5%, 셋이면 약 98.3%이다. 이렇게 하면 검사 전체에서 잘못 실패할 확률이 5퍼센트 이하로 유지된다. 조정된 수준은 8장이 제시하는 것이며, 게이트도 같은 수준을 쓴다. 리샘플 횟수는 2,000으로, 시드는 고정으로 유지하므로 다시 실행해도 같은 구간이 나온다.
게이트는 모든 변경에 대해 dev 항목으로 실행한다. 게이트는 매번 실행되어야 하고, 팀이 그 항목들에 맞춰 조정했을 수 있기 때문이다. 홀드아웃은 릴리스 결정마다 한 번, 실행 전에 정해 둔 규칙에 따라 실행하며, 이는 홀드아웃, 단 한 번에서 설명한다. 그 이후에는 새로운 홀드아웃 집합이 필요하다.
게이트를 CI에 넣으려면, 작업이 후보의 기록에 대해 게이트를 계산하고 결정이 실패일 때 빌드를 실패시킨다. 게이트는 항목별 값만 읽으므로 작업에는 다른 상태가 필요 없다. 실행에 실패한 작업은 게이트 실패로 센다. 건너뛴 게이트는 통과처럼 보일 것이기 때문이다. 게이트 자체의 테스트는 위의 규칙을 검사한다. 이 테스트는 평가 자체의 테스트에서 평가의 나머지 테스트와 함께 실행된다.
작업 규칙: 모든 쌍체 차이는 구간과 n을 함께 보고하고, 결정은 상한에서 따라 나오게 한다. 점추정치만으로 변경이 더 좋다거나 더 나쁘다고 말하지 말고, 구간이 넓은 통과를 후보가 기준선과 같다는 증거로 읽지 않는다.
이 부분은 아직 번역되지 않았으므로 영어로 표시된다.
Flag flaky items, never edit them
An item flips when its sampled replies get different verdicts. Each dev item has five verdicts from the variance set, and an item is flaky when they are not all the same. The variance set and the flip rate, the share of items that flip, are introduced in Variance within one item. A team watches the flip rate to see how far the verdicts move when the assistant's replies do.
Each flagged item comes with its PASS count out of five, in id order, and the rule it is held to is printed beside the list.
1"""The dev items flagged as flaky: the judge's verdict differs across their five variance samples. Each flagged item prints its2PASS count out of five, sorted by id, and the count matches the flip rate in flip-rate.py, since both read the same per-item3counts. A flagged item is kept as it is, so the rule printed last is the whole policy: flagged, never edited or deleted."""4import lib # first: fixes the thread counts and seeds before anything else loads56from lib.testset import load_items7from lib.variance import VARIANCE_SAMPLES, item_pass_counts89VARIANCE = "judge-answers-variance"10SAMPLES = len(VARIANCE_SAMPLES)1112items = [item.id for item in load_items(split="dev")] # eighty dev items, sorted by id13counts = item_pass_counts(VARIANCE, items)14for row in counts:15 if not row.complete: # an unreadable sample is not a FAIL: the item is named here and not flagged16 samples = ", ".join(str(sample) for sample in row.unreadable)17 print(f"left out, unreadable verdict, {row.item_id}: samples {samples}")18flagged = [row for row in counts if row.flaky]19for row in flagged:20 print(f"{row.item_id}: {row.passes} of {SAMPLES} PASS")21print(f"flagged items: {len(flagged)}")22print(f"dev items compared (n): {sum(1 for row in counts if row.complete)}")23print("rule: flagged, never edited or deleted")
python flaky-items.pyleft out, unreadable verdict, q-0043: samples 1, 4
q-0047: 4 of 5 PASS
q-0058: 1 of 5 PASS
flagged items: 2
dev items compared (n): 79
rule: flagged, never edited or deleted
Few items flip on this set. The flagged items come to 2 of the 79 dev items compared. Both flagged items are worth reading.
On q-0047, the verdicts across its five replies are 4 of 5 PASS, so most of its replies passed. On q-0058, the verdicts are 1 of 5 PASS, so most of its replies failed.
One item is set aside rather than used. The item q-0043 is left out, since its verdict was unreadable in samples 1, 4. An unreadable sample is not a fail. It is a sample the example cannot read, so the item is neither flagged nor counted on that basis.
The rule is that a flagged item stays flagged, never edited or deleted. It stays in the set with the verdicts the judge gave. Editing it until the judge agrees more often would hide the very signal the flag exists to show. Deleting it would shrink the set and make the pass rate look steadier than it is. The flag does its work when someone reads it. A flagged item with one PASS in five is a question about the item, the rubric, the judge or the assistant's replies, and it should be looked at before the next change is judged on it.
The count is small, and it describes this assistant, this judge and these dev items. It shows that few items flip in this set. It does not show that other assistants, sampling settings or judges flip as rarely. A team that changes any of them should run the variance set again before it trusts a low flip rate.
A flagged item can also move a paired difference from one run to the next. When a gate fails on a difference that depends on a flagged item, read the flag before the change.
Working rule: Flag an item whose verdicts differ across its samples, print its count beside the flag, and leave the item as it is. Report the flip rate with its denominator, and say that a low rate holds for this assistant, this judge and this set only.
평가 자체의 테스트
평가는 코드이며, 그 코드는 결과처럼 보이는 방식으로 틀릴 수 있다. 부트스트랩, 판정 읽기 코드, 쌍체 차이 계산에 버그가 있으면 어시스턴트가 바뀌었을 때와 똑같이 수치가 움직인다. 그래서 평가에는 자체 테스트가 있으며, 이 테스트는 책의 라이브러리 안에 있는 tests 폴더에 들어 있다. 책이 추가하는 각 모듈은 자기 테스트를 함께 가져온다. 이 테스트는 채점 코드를 검사하는 것이지 어시스턴트를 검사하는 것이 아니다. 테스트가 통과했다는 것은 코드가 세겠다고 한 것을 실제로 센다는 뜻일 뿐이다. 어시스턴트가 답을 잘하는지에 대해서는 아무것도 말해 주지 않는다.
이 테스트들은 하나의 프로세스에서 실행되고, 결과는 모듈별로 집계된다. 예제는 이어서 9.2.0 버전의 pytest가 내놓은 종료 코드를 출력한다. 종료 코드 참조 문서에 따르면 0은 수집된 모든 테스트가 통과했다는 뜻이고, 5는 수집된 테스트가 없다는 뜻이다. 따라서 아무것도 테스트하지 않은 실행은 조용히 통과하지 않고 5로 드러난다.
1"""Runs the book's own tests, lib/tests, in this process and prints how many passed and failed in each module, then pytest's2exit code. Exit code 0 means every test was collected and passed. Exit code 5 means nothing was collected, so the example3prints the code it got rather than a silent pass. No paths and no timings are printed: they vary from run to run."""4import lib # first: fixes the thread counts and seeds before anything else loads56from collections import Counter7from pathlib import Path89import pytest1011TESTS = Path(lib.__file__).resolve().parent / "tests" # read here, never printed121314class Outcomes:15 """Counts each test's outcome by module. A failed setup or teardown counts as a failure of its test."""1617 def __init__(self) -> None:18 self.passed = Counter()19 self.failed = Counter()2021 def pytest_runtest_logreport(self, report) -> None:22 # The node id starts with the file's path; keep only the module's name, so no path is printed.23 module = Path(report.nodeid.split("::")[0]).stem24 if report.when == "call" and report.passed:25 self.passed[module] += 126 elif report.failed:27 self.failed[module] += 1282930collector = Outcomes()31# -p no:terminal turns off pytest's own printing, which carries timings. That also removes the -q option, which belongs to32# the terminal reporter, so it is not passed. -p no:cacheprovider keeps .pytest_cache out of the working copy.33exit_code = pytest.main(34 [str(TESTS), "-p", "no:terminal", "-p", "no:cacheprovider"],35 plugins=[collector],36)3738modules = sorted(path.stem for path in TESTS.glob("test_*.py")) # every module, even one with no failures39print("tests by module (passed, failed):")40for module in modules:41 print(f" {module}: {collector.passed[module]} passed, {collector.failed[module]} failed")42print(f"total: {sum(collector.passed.values())} passed, {sum(collector.failed.values())} failed")43print(f"pytest exit code: {int(exit_code)}")
python own-tests-run.pytests by module (passed, failed):
test_bench: 11 passed, 0 failed
test_bias: 14 passed, 0 failed
test_both_orders: 14 passed, 0 failed
test_calibration: 9 passed, 0 failed
test_calibration_bootstrap: 8 passed, 0 failed
test_contract: 5 passed, 0 failed
test_gate: 11 passed, 0 failed
test_guard: 4 passed, 0 failed
test_judging: 3 passed, 0 failed
test_stats: 10 passed, 0 failed
test_support_verdict: 5 passed, 0 failed
test_testset: 5 passed, 0 failed
test_variance: 15 passed, 0 failed
total: 114 passed, 0 failed
pytest exit code: 0
표는 모듈별 결과를 보여 주고, 각 모듈이 무엇을 테스트하는지도 옆에 함께 적는다.
| 모듈 | 테스트 대상 | 결과 |
|---|---|---|
| test_bench | 벤치마크 로더와 채점기 | 11 passed, 0 failed |
| test_bias | 길이 구간, 읽을 수 없는 판정, 뒤집힘 방향, 구간 간 격차 | 14 passed, 0 failed |
| test_both_orders | 쌍별 판정 읽기 코드와 두 가지 순서: 응답으로 되돌리는 매핑, 그리고 네 가지 유형 | 14 passed, 0 failed |
| test_calibration | 판정자 대 사람의 집계, 일치도, 카파, TPR, TNR, 보정된 통과율 | 9 passed, 0 failed |
| test_calibration_bootstrap | 교차점과 보정된 통과율의 부트스트랩 구간 | 8 passed, 0 failed |
| test_contract | 판정자와 어시스턴트가 지켜야 하는 응답 및 판정 형식 | 5 passed, 0 failed |
| test_gate | 게이트의 규칙: 상한이 임곗값의 음수보다 낮을 때만 실패 | 11 passed, 0 failed |
| test_guard | 직접 만든 행에 대한 거절 가드의 규칙과 임곗값 | 4 passed, 0 failed |
| test_judging | 판정자 판정 읽기와 쌍체 차이 타입 | 3 passed, 0 failed |
| test_stats | 출력 도우미와 시드가 고정된 부트스트랩 | 10 passed, 0 failed |
| test_support_verdict | 충실성 판정 읽기 코드: 첫 줄의 SUPPORTED 또는 UNSUPPORTED | 5 passed, 0 failed |
| test_testset | 테스트 세트 로딩과 항목 전반을 가로질러 살피는 규칙 | 5 passed, 0 failed |
| test_variance | 분산 세트에 대한 항목별 판정 횟수 | 15 passed, 0 failed |
합계는 마지막에 나온다. 합계는 114 passed, 0 failed이고 종료 코드는 0이며, 이는 수집된 모든 테스트가 통과한 실행의 코드다.
이 표는 어시스턴트가 아니라 측정 도구를 점검한 결과로 읽어야 한다. 게이트 작업에서 이 테스트를 가장 먼저 실행하면, 고장 난 채점기가 통과율을 읽기 전에 작업을 멈추게 할 수 있다. 실행마다 달라지는 것은 출력하지 않는다. 시간도 경로도 출력하지 않는다. 독자는 코드를 다시 실행하여 출력을 줄 단위로 비교할 수 있다.
작업 규칙: 수치를 읽는 모든 실행에 앞서 평가 자체의 테스트를 실행하고, 종료 코드 5는 통과가 아니라 실패로 취급한다. 채점 코드의 테스트가 하나라도 실패하면, 수치가 무엇을 말하든 그 수치는 아직 신뢰할 수 없다.
이 부분은 아직 번역되지 않았으므로 영어로 표시된다.
Running it as a framework task
Teams that already use an evaluation framework can map the parts of this book onto its words, and it helps to see the mapping once. In Inspect AI 0.3.291, dated 17 November 2026 in its changelog, a task is the recipe for an evaluation, made minimally of a dataset, a solver and a scorer, as the framework's documentation at that version describes. On that reading, the test set is the dataset, with one sample per item. The assistant's path of retrieving and then answering is the solver, and the checks and the judge make up the scorer. The book does not run that mapping, and it does not claim to. Instead, the book keeps one example environment: one set of files that every chapter's examples import, pinned to the same versions, so the replay model, the checks and the gate are the same code in every chapter. This chapter describes where each part would go, so that a reader on a framework can move the parts over while the book's examples stay as they are.
Working rule: When you map an evaluation onto a framework, name the framework's version and the date of its documentation. Keep the test set, the checks and the replay model as the files the book's examples run, and treat the map as a reading of the documentation until someone runs it.
이 부분은 아직 번역되지 않았으므로 영어로 표시된다.
Variants on traffic
Offline, the test set and the replayed answers can say which variant is better on the items the team wrote. Once the assistant is live, a team may want to compare two variants on real questions, such as two prompts or two models, each sent to a share of users. That is a comparison, and it is only as good as the way users were assigned to the variants. If the people who see one variant are the ones who ask harder questions, the difference reflects them and not the variant. Random assignment, and an interval read the way the rest of this chapter reads one, are what turn a live comparison into a test. Kohavi and colleagues' guide, which chapter 10 cites, recommends deciding the power and the effect to detect, and estimating the variability, before the test starts. Without that, a live comparison is a list of who saw which variant.
The feedback table in this section is not traffic. Its rows are generated. Each dev item's vote is drawn from a stated model with a fixed seed. An answer is right with probability 0.85. A user who sees a wrong answer gives a thumbs-down with probability 0.5 and a thumbs-up with 0.05. A user who sees a right answer gives a thumbs-down with 0.03 and a thumbs-up with 0.15. Most items get no vote at all. Whether each answer was right is drawn and then dropped, as it would be in a real log, so the table holds only the votes. It is a teaching device, and its figures are what the stated model produces. They say nothing about this assistant.
1"""A generated table of thumbs-up and thumbs-down rows over the eighty dev items, with what such a table can show and what it2can't. The rows are generated from a stated model with a fixed seed, not taken from users, so the table is a teaching3device only.45The model: an answer is right with probability 0.85. A user who sees a wrong answer gives thumbs-down with probability 0.5 and6thumbs-up with 0.05; one who sees a right answer gives thumbs-down with 0.03 and thumbs-up with 0.15. Most items get no vote.7The table keeps the votes only: whether each answer was right is drawn and then dropped, as it would be in a real log."""8import lib # first: fixes the thread counts and seeds before anything else loads910import numpy as np1112from lib import SEED13from lib.stats import pct14from lib.testset import load_items1516P_RIGHT = 0.8517P_DOWN_WRONG, P_UP_WRONG = 0.50, 0.0518P_DOWN_RIGHT, P_UP_RIGHT = 0.03, 0.151920rng = np.random.default_rng(SEED) # one generator for the whole table, so the same seed gives the same rows21items = [item.id for item in load_items(split="dev")]22rows = [] # (item id, vote) for each item that got a vote23for item_id in items:24 right = rng.random() < P_RIGHT # hidden: the table has no column for it25 draw = rng.random()26 down, up = (P_DOWN_RIGHT, P_UP_RIGHT) if right else (P_DOWN_WRONG, P_UP_WRONG)27 if draw < down:28 rows.append((item_id, "thumbs-down"))29 elif draw < down + up:30 rows.append((item_id, "thumbs-up"))3132print("generated rows from a stated model, not user feedback (seed 0)")33print("item vote")34for item_id, vote in rows:35 print(f"{item_id} {vote}")3637ups = sum(vote == "thumbs-up" for _, vote in rows)38downs = sum(vote == "thumbs-down" for _, vote in rows)39voted = len({item_id for item_id, _ in rows})40print(f"dev items: {len(items)}")41print(f"items with a vote: {voted}")42print(f"items nobody voted on: {len(items) - voted}")43print(f"thumbs-down among those who voted: {pct(downs, ups + downs)}")44print(f"thumbs-up among those who voted: {pct(ups, ups + downs)}")45print("what the table can show: the share of each kind of vote, among the votes cast, with its n.")46print("what it can't show: anything about the items nobody voted on; whether a thumbs-up answer was right.")
python feedback-table.pygenerated rows from a stated model, not user feedback (seed 0)
item vote
q-0002 thumbs-down
q-0006 thumbs-down
q-0007 thumbs-down
q-0008 thumbs-up
q-0009 thumbs-up
q-0011 thumbs-up
q-0020 thumbs-down
q-0027 thumbs-down
q-0028 thumbs-up
q-0030 thumbs-up
q-0035 thumbs-up
q-0040 thumbs-down
q-0056 thumbs-down
q-0057 thumbs-down
q-0059 thumbs-down
q-0060 thumbs-up
q-0064 thumbs-down
q-0070 thumbs-down
q-0072 thumbs-up
q-0079 thumbs-down
q-0080 thumbs-down
dev items: 80
items with a vote: 21
items nobody voted on: 59
thumbs-down among those who voted: 61.9% (13 of 21)
thumbs-up among those who voted: 38.1% (8 of 21)
what the table can show: the share of each kind of vote, among the votes cast, with its n.
what it can't show: anything about the items nobody voted on; whether a thumbs-up answer was right.
Under the stated model, only 21 of the 80 dev items get a vote, and 59 get none. So the table says little about the other items.
A vote is not a correctness label, and this table shows why. Under the stated model, answers are right 85% of the time, yet most votes are thumbs-down, because a wrong answer draws a vote far more often. Among the votes cast, thumbs-down is 61.9% (13 of 21). Thumbs-up is 38.1% (8 of 21).
A table of votes can show the share of each kind of vote, among the votes cast, with the count beside it, and the example's last lines say exactly that. It cannot show whether a thumbs-up answer was right, since the table has no column for correctness. It says nothing about the items nobody voted on, and a vote comes from someone who chose to vote on what they chose to read.
Joachims and colleagues studied clicks on search results in 2005 and found them informative but biased, so a click is not an absolute judgment of relevance. They report that relative preferences derived from clicks are reasonably accurate on average, in their paper on interpreting clickthrough data. This book uses that finding as an analogy only, and it is the book's own reading. A thumbs-up is a vote, not a label. A right answer can still draw a thumbs-down, and the table has no way to tell which votes those are.
Two groups of users are compared differently from the paired items above. Each user sees one variant, so the two groups are separate, and the interval for their difference is a different calculation from the paired one this chapter uses. Chapter 8 covers the paired comparison this chapter uses. It does not cover an interval for two separate groups.
A vote table also cannot compare variants unless each vote is tied to the variant the user saw. This table has no variant column, so it cannot compare anything. A live comparison would need that column, the random assignment above, and an interval. If few items get a vote, as in this generated table, the interval would be wide, and most items would have no vote to compare.
Before a real vote table could be trusted, it would need three things. Each vote would need to be tied to the variant the user saw. The share of items that get a vote would need to be reported with its count, since a table of votes speaks only to the items that were voted on. And a sample of its votes would need checking against correctness, so that a thumbs-up or a thumbs-down can be read against what it is meant to measure.
The book's parts add up to an evaluation for a feature of your own. A labelled test set comes first (chapter 3), then checks in code (chapter 4). A judge with a rubric and a measured error follows (chapter 5, chapter 6). A comparison reports its interval and n (chapter 8), and the gate in CI reads all of it. Chapter 7 says where the judge stops being reliable. Chapter 9 and chapter 10 apply the same counts to grounding and declining.
The book leaves three subjects to others. A Primer on Search Relevance covers ranking metrics. Agent Harnesses covers tasks that take several steps. Observability for LLM Applications covers tracing one request through retrieval and the model, and counting what each request costs. It is planned, so it is named here and not linked.
Working rule: Don't compare variants from traffic without random assignment and the variant recorded beside each vote or reply. Read a vote table as a share of the votes cast, with its count, and never as a measure of correctness.
이 판의 이 장
2026.11.3판예제 통과 2026년 11월 21이 장에서 4개 예제개 중 4개가 통과한다
영어판 2026.11.3판을 번역한 것이다.