回答が引用された文書に基づき、問われたバージョンに沿っていることを確認する

読了まで約33 分分、8 節 節の 6 例 例。

第2026.11.3版 2026年11月21日時点で例が通過 54 例中 54 例が合格 変更点

AIによる翻訳。英語版は人による検証済みである。 当社の書籍の作り方

英語版の書籍(版2026.11.3)から翻訳した。 原文を読む

この章を読み終えると、回答の引用がその回答の述べる内容を裏づけているか、回答中のすべての主張がアシスタントに与えられた節に基づいているか、回答が読者の尋ねたバージョンに対して正しいか、そしてその途中で検索が正しい節に到達していたかを、数え上げて確かめられるようになる。

正しい回答であっても、質の低い回答であることはありうる。本書のアシスタントは、sablefile に関する質問にその文書から答える。回答が合格となるのは、質問が尋ねるバージョンについての参照回答と一致したときである。ところが、回答はこの検査に合格しながら、その文が述べる内容を実際には述べていない節を引用していたり、どの節にも書かれていない細部を付け加えていたり、別のバージョンの文書から事実を取っていたりすることがある。合格率はこれらのいずれも捉えられない。一方、主張の隣にある引用を確かめる読者は、これらを見抜くことができる。アシスタントに引用を求めるのは、そのためである。

合格率と並んで四つの検査があり、それぞれが固有の分母に対する固有の件数を持つ。引用の正確さは、各引用が、項目が裏づけとして挙げている節を指しているかを問う。忠実性は、各主張がアシスタントに示された節の中にあるかを問う。バージョンの正しさは、回答が尋ねられたバージョンに合っているかを問う。経路に対する結果は、合格が該当する節を手にした上でのものであったか、また不合格の場合にもその節を手にしていたかを問う。引用の正確さと忠実性では、辞退は対象から除く。辞退は検査すべき主張を含まないからである。バージョンの正しさと検索の表では、合格率と同じく辞退を残し、それぞれが含まれる辞退の件数を表示する。

ここでいう「根拠がある」とは

回答に根拠があるとは、その引用をたどった読者が、引用の示す場所に、尋ねたバージョンのまま主張を見つけられることである。そのためには三つのことが成り立たなければならない。第一に、引用がそのバージョンに存在し、付された文を裏づけていること。第二に、回答中のすべての主張が、アシスタントの読んだ節から導かれること。第三に、回答がそのバージョンに対して正しいこと。同じ語を使う別のバージョンに対して正しいだけでは足りない。

リモート取得があきらめるまでにどれだけ待つのかを尋ねた読者を考える。返信がもっともらしい答えを示し、リモートテンプレートの取得に関する節を引用しているが、その節には待ち時間が書かれていないとする。読者はこの返信を根拠があるものと受け取るだろうし、引用も正しそうに見える。ところが節を開いた読者は、その数値を裏づける記述を何も見つけられない。合格率は、その数値がたまたま参照解答と一致していれば、この返信を正解として数えることになる。忠実性は、判定器を通して節そのものを読むチェックである。引用チェックが読むのはIDだけであり、その点を自ら明示している。

これらの失敗は互いに異なり、それぞれ別個に数える必要がある。返信に裏づけとなる引用があっても、節に書かれていない細部を述べていることがあるので、引用の正確さからは忠実性が分からない。返信があるバージョンの節に忠実でも、別のバージョンに対しては誤っていることがあるので、忠実性からはバージョンの正しさが分からない。さらに、返信が正しく、引用も適切でありながら、検索の段階が、その返信が拠り所とする節に一度も到達していないことがある。結果と経路の対比は、この場合を見つけるためにある。

実践ルール: それぞれのチェックに固有の分母を用いて個別に数え、合格は読み取りの終わりではなく始まりとして扱う。

引用の正確さ

引用とは、文書についての主張である。この節は、このバージョンにおいて、それが付された文を裏付ける、という主張である。他の主張と同じく、引用も誤りうる。節は存在していても、別のことを述べている場合がある。別のバージョンに属している場合もある。あるいは、回答がその項目の挙げていない節を引用している場合もある。Primer は文単位の確認を引用された項目が何を裏付けるかの確認で扱い、モデルに与えられた文脈については文脈に対する引用の確認で扱っている。本書の確認はそれより単純であり、4章の引用の確認がその4つの結果を示している。この確認は、引用された各 ID を、問われたバージョンについてその項目が挙げている裏付け節の一覧と照合する。節そのものは読まないため、文については何も述べない。

コードは同じ回答から2つの数を出力する。引用率は、回答のあった項目に含まれるすべての引用のうち、裏付けのあるものを数える。項目率は、回答のあった項目について、引用の少なくとも1つに裏付けがあれば1件として数える。したがって、良い引用が1つあれば項目全体が成り立つ。問われたバージョンの節への引用で、その項目の一覧にないものは、一覧外として出力される。その節が正しい可能性も十分にあるため、確認はそれを誤りとは呼ばず、確かめるために節を開くこともしない。一覧外の引用を読んで判断するのは、人の手作業である。その節が文を裏付けているなら、その項目の裏付け節の一覧が不完全であり、テストセットの所有者が追加すべきである。裏付けていないなら、その引用は誤りであり、その回答は引用に失敗したものとして読むべきである。

両方の分割に対して実行し、引用の行より先に項目の行を読む。

citation-accuracy-counts.py Python 3.12.15 · numpy 2.5.5 · pydantic 2.14.3 · typing-extensions 4.16.0 合格
"""Counts the baseline's answered items that cite a supporting section of the asked version, dev and held-out apart.An item counts once, and only if one of its citations is supported; its other citations sit in the citation lines. A declineis not an answer, so it is left out of every count. The check matches each cited ID against the item's listed supportingsection IDs for its asked version. It never reads the section's text, so it does not check what the sentence says.The first line of each split is the point: the item rate."""import lib  # first: fixes the thread counts and seeds before anything else loadsfrom lib.contract import citation_outcomes, parse_reply, section_ids_by_versionfrom lib.prompts import P1_SHA256from lib.replay import ReplayModelfrom lib.stats import pctfrom lib.testset import load_itemsids = section_ids_by_version()  # every version's section IDs, read from the docs, for telling wrong-version from missingmodel = ReplayModel("assistant-baseline", P1_SHA256)  # the baseline's replies, sample 0, made from prompt P1def supporting_ids(item):    """The item's supporting section IDs in its asked version. Another version's listed sections are not counted here."""    return frozenset(s.section_id for s in item.supporting_sections if s.version == item.version)for split in ("dev", "held-out"):    declined = 0    results = {}  # item id -> its citation outcomes, for each answered item    for item in load_items(split=split):        reply = parse_reply(model.reply(item.id, 0))        if reply.declined:            declined += 1        else:            results[item.id] = citation_outcomes(reply, item.version, supporting_ids(item), ids)    # An answer to an unanswerable item lists no section of its asked version, so it can never count as supported here.    outcomes = [outcome for found in results.values() for outcome in found]  # every citation, in item order    with_support = [item_id for item_id, found in results.items() if "supported" in found]    no_support = sorted(set(results) - set(with_support))    print(f"{split} declined items, left out: {declined}")    print(f"{split} answered items: {len(results)}")    print(f"{split} answered items citing a supporting section of the asked version: {pct(len(with_support), len(results))}")    print(f"{split} answered items with no supported citation: {len(no_support)}")    print("  " + (", ".join(no_support) or "none"))    print(f"{split} citations: {len(outcomes)}")    print(f"{split} citations that are supported: {pct(outcomes.count('supported'), len(outcomes))}")    print(f"{split} citations that are unlisted: {pct(outcomes.count('unlisted'), len(outcomes))}")    print(f"{split} citations that are wrong-version or missing: "          f"{pct(outcomes.count('wrong-version') + outcomes.count('missing'), len(outcomes))}")
出力python citation-accuracy-counts.py
dev declined items, left out: 23
dev answered items: 57
dev answered items citing a supporting section of the asked version: 94.7% (54 of 57)
dev answered items with no supported citation: 3
  q-0005, q-0057, q-0058
dev citations: 60
dev citations that are supported: 93.3% (56 of 60)
dev citations that are unlisted: 6.7% (4 of 60)
dev citations that are wrong-version or missing: 0.0% (0 of 60)
held-out declined items, left out: 15
held-out answered items: 25
held-out answered items citing a supporting section of the asked version: 96.0% (24 of 25)
held-out answered items with no supported citation: 1
  q-0090
held-out citations: 33
held-out citations that are supported: 93.9% (31 of 33)
held-out citations that are unlisted: 6.1% (2 of 33)
held-out citations that are wrong-version or missing: 0.0% (0 of 33)

dev では、項目率は 94.7% (54 of 57) である。

dev では、回答のあった項目のうち 3 件に裏付けのある引用がなく、出力はそれらの項目を名指しする。held-out では、その件数は 1 である。

dev の引用率は 93.3% (56 of 60) である。dev の一覧外の引用は 6.7% (4 of 60) 件で、出力はこれを報告するが、誤りとしては数えない。

held-out では、項目率は 96.0% (24 of 25)、引用率は 93.9% (31 of 33) である。held-out で回答のあった項目は 25 件しかないため、1件の違いで率が大きく動く。分割間の差を本物と呼ぶには、まず区間が必要であり、その作り方は区間とサンプルサイズで説明している。

誤りの理由を確認が名指しできるのは、誤バージョンまたは欠落の引用である。dev では 0.0% (0 of 60) 件、held-out では 0.0% (0 of 33) 件である。したがって、引用率が100%に届かないのは一覧外の引用のためであり、それらは人が読まなければならない。

2つの率が食い違うのには、単純な理由がある。裏付けのある引用が1つ、一覧外の引用が1つある項目は、項目率では成り立つ項目として数えられ、引用率は下げる。両方を読めば、取りこぼしが項目全体にあるのか、それ以外は問題のない項目の中の個々の引用にあるのかが分かる。

この確認の背後にある考え方は、本書の外でも研究されている。Gao ら(2023)は、EMNLP 2023 と arXiv で、生成された回答における引用のベンチマークを構築し、強力なモデルによる回答の多くが、引用された文章によって完全には裏付けられていなかったと報告した。彼らの設定は本書のものとは異なるため、そこから数値は持ち込まない。この論文は、考え方の出典として挙げている。

実践ルール: 項目率と引用率を併せて読み、プロンプトを変更する前に、一覧外の引用を1つずつ読むこと。一覧外の引用は、文書に対する問いであり、数えるべき誤りではない。

忠実性

引用の正確性はモデルを使わずに計算できるが、その件数が示すのは、いくつの引用が一覧にある節を指しているかであって、各文が成り立つかどうかではない。次の問いが忠実性であり、引用をまったく伴わない主張を捉えるのはこの問いである。

引用の正確性が調べるのは、引用を伴う文だけである。回答が引用なしで述べた主張はこの検査をすり抜ける。引用された節が一部しか支持していない主張も同様である。忠実性はより広い問いを立てる。回答中のすべての主張は、アシスタントに示された節から導かれるか。

Ragas(Es ら、2023年、これもプレプリント)は、忠実性を、回答に含まれる文のうち文脈が支持するものの割合として採点する。回答を文に分割し、それぞれを検査する。本書は、これに代えて回答ごとに一つの問いを立てる。lib/prompts.pyにある忠実性のプロンプトは、判定者に節と回答を与える。判定者は回答を主張ごとに読み、すべての主張が成り立つ場合に限り、最初の行にVERDICT: SUPPORTEDと書く。そうでなければVERDICT: UNSUPPORTEDと書き、続けて理由を一文で述べる。

引用の正確性との違いは、回答の途中で現れる。ある回答が二つの文からなるとする。一つ目の文は、それを支持する節への引用を伴う。二つ目の文は、節にない細部を加えているため引用を伴わない。引用の正確性は一つ目の文を採点し、二つ目の文については何も述べない。忠実性は回答全体を読むので、二つ目の文だけを理由にその回答を不支持と判定できる。どちらの検査も他方の代わりにはならない。両方を残すのはそのためである。

この判定者の判定を人間の判定と照らし合わせた者はいないため、ここでの忠実性の割合はすべて未較正である。判定者はアシスタント自身のモデルである Qwen3-4B-Instruct-2507 でもあり、そのモデルが書いた回答を採点している。これがなぜ問題になるのか、そして本書がなぜそれを検証できないのかは、自己選好で説明する。判定者を較正するには、これらの回答に対する人手の評価が必要だが、本書にはそれがない。判定者を較正するでは、判定者と手作業の評価を比較する方法を述べている。これらの割合は較正されていないため、転移の仮定が引き継ぐものは何もなく、どこで止めるかの限界がそのまま当てはまる。

faithfulness-rate.py Python 3.12.15 · numpy 2.5.5 · pydantic 2.14.3 · typing-extensions 4.16.0 合格
"""The faithfulness rate of assistant-baseline's answered items, as judged in judge-faithfulness-baseline, dev and held-out apart.An answered item is one the baseline did not decline and whose reply is not empty; a decline is left out. The judge writesSUPPORTED or UNSUPPORTED on its first line. A reply that is neither is printed by item ID and left out of the denominator,never counted as UNSUPPORTED. The judge is uncalibrated: this book has no human ratings for it, so the rates are notcorrected for its errors and are not a calibrated measure. When every readable verdict is the same, the percentilebootstrap cannot vary, so the example says so and prints the exact binomial bound for n of n instead."""import lib  # first: fixes the thread counts and seeds before anything else loadsfrom lib.contract import parse_replyfrom lib.judging import parse_support_verdictfrom lib.prompts import FAITH_SHA256, P1_SHA256from lib.replay import ReplayModelfrom lib.stats import bootstrap_mean, interval_pct, pctfrom lib.testset import load_itemsanswers = ReplayModel("assistant-baseline", P1_SHA256)  # the baseline's replies, sample 0, made from prompt P1judge = ReplayModel("judge-faithfulness-baseline", FAITH_SHA256)  # the judge's replies, made from the faithfulness promptprint("judge: judge-4b, uncalibrated (no human ratings in this book)")for split in ("dev", "held-out"):    answered = []    for item in load_items(split=split):        reply = parse_reply(answers.reply(item.id, 0))        if not reply.declined and reply.text:            answered.append(item.id)    readable = {}  # item id -> 1.0 for SUPPORTED, 0.0 for UNSUPPORTED    for item_id in answered:        raw = judge.reply(item_id, 0)        verdict = parse_support_verdict(raw)        if verdict is None:            line = next((ln.strip().strip("*`").strip() for ln in raw.splitlines() if ln.strip()), "")            print(f'{split} unreadable verdict, left out: {item_id} ("{line}")')        else:            readable[item_id] = 1.0 if verdict == "SUPPORTED" else 0.0    scores = list(readable.values())    lo, hi = bootstrap_mean(scores)  # level 0.95; seed SEED, 2,000 resamples    print(f"{split} answered items: {len(answered)}")    print(f"{split} unreadable verdicts: {len(answered) - len(readable)}")    print(f"{split} faithfulness rate: {pct(int(sum(scores)), len(scores))}")    print(f"{split} 95% interval of the faithfulness rate: {interval_pct(lo, hi)}")    if len(set(scores)) == 1:  # every readable verdict is the same, so resampling cannot vary        print(f"{split} bootstrap interval is degenerate: all {len(scores)} readable verdicts are the same")        if sum(scores) == len(scores):            print(f"{split} exact 95% lower bound for {len(scores)} of {len(scores)}: {100 * 0.025 ** (1 / len(scores)):.1f}%")    if split == "dev":        unfaithful = sorted(item_id for item_id, score in readable.items() if score == 0.0)        print(f"dev unfaithful items, first five: {', '.join(unfaithful[:5])}")
出力python faithfulness-rate.py
judge: judge-4b, uncalibrated (no human ratings in this book)
dev answered items: 57
dev unreadable verdicts: 0
dev faithfulness rate: 94.7% (54 of 57)
dev 95% interval of the faithfulness rate: [87.7%, 100.0%]
dev unfaithful items, first five: q-0013, q-0029, q-0055
held-out answered items: 25
held-out unreadable verdicts: 0
held-out faithfulness rate: 100.0% (25 of 25)
held-out 95% interval of the faithfulness rate: [100.0%, 100.0%]
held-out bootstrap interval is degenerate: all 25 readable verdicts are the same
held-out exact 95% lower bound for 25 of 25: 86.3%

この例は、ベースラインの回答済み項目を取り、辞退を除き、それぞれについて判定者に尋ねる。割合を出力するのは、読み取れる判定に限る。SUPPORTED でも UNSUPPORTED でもない返答は、項目ごとに出力され、分母から除かれる。判定を先にで説明するとおり、それを失敗として数えることはない。

dev の未較正の忠実性の割合は94.7% (54 of 57)である。その区間は[87.7%, 100.0%]である。この区間の上端が割合の尺度の上限に接しているのは、ブートストラップが上限を超えて再標本化できないためである。それでも区間は広く、これは57件の回答済み項目に対する正直な読み方である。

held-out の未較正の忠実性の割合は100.0% (25 of 25)である。出力された区間は[100.0%, 100.0%]だが、これは区間ではない。出力はブートストラップが退化していると述べている。all 25 readable verdicts are the same。すべて合格した項目を再標本化しても同じ割合しか返らないため、ブートストラップは割合がどこにあるかについて何も語らない。

正確な 95% 下限は86.3%である。真の割合がこれを下回るとき、held-out の回答がすべて合格する確率は 2.5% 未満になる。この下限は 0.025 の n 分の 1 乗である。これが示すのは、判定者がこれらの回答を合格にしたということであり、割合がどこにあるかを示すには分割が小さすぎる。held-out の数値を、アシスタントが忠実であるという知見として読んではならない。

二つの検査は、それぞれ固有の一覧を出力する。引用の出力は支持された引用のない項目を挙げ、忠実性の出力は最初の不忠実な dev 項目を挙げる。この章は二つの一覧が同じ項目を挙げるとは仮定しないので、両者を並べて読むこと。

実践ルール: すべての忠実性の割合に「未較正」と添え、割合を信頼する前に最初の不忠実な項目を読むこと。忠実性の検査が示すのは、判定者が主張を不支持と述べる箇所である。判定者が正しいことまでは示さない。

バージョン正確性

最終変更:版2026.11.3

sablefile のドキュメントには 1.0、1.1、2.0 の三つのバージョンがあり、質問によってはバージョンごとに答えが異なる。回答が 1.1 の節に根拠を置いていても、2.0 を使う読者にとっては誤りとなりうる。本書ではこうした項目をバージョン依存項目と呼ぶ。各項目には、読者が尋ねたバージョンに対する参照回答があり、その検査では回答がこの参照と一致するかどうかを確認する。バージョン依存項目は dev に 17 件、held-out に 8 件ある。

バージョン依存項目は、他のすべての項目と同様に合格率に数えられるが、それとは別に専用の件数も持つ。これらの項目への回答は、尋ねられたバージョンの参照回答に照らして判定されるため、別のバージョンでは正しい答えであっても不合格となる。この取りこぼしが一般の合格率に混ざるだけでは、アシスタントが弱いように見えてしまう。正答判定率はバージョン依存項目だけを対象にした件数であり、これによってバージョンの取りこぼしが独立した行に現れ、検索の変更がその値を動かしたかどうかをチームが確認できる。回答辞退は、合格率の場合と同様にこの分母に残り、各分割には辞退が何件含まれるかも併せて表示される。

誤バージョン引用は別の件数である。これは、別のバージョンにしか存在しない節への引用を指す。回答が尋ねられたバージョンに対して正しくても、別のバージョンの節を引用することがあり、その引用をたどった読者は誤ったドキュメントにたどり着く。

この検査が見られるのは、ID が示す情報だけである。引用が持つのは ID であり、バージョンではない。ほとんどの ID はバージョン間で重複するため、1.0、1.1、2.0 のすべてに現れる節 ID は、どのバージョンでも同じに見える。すべてのバージョンに現れる ID は、読者がどのバージョンを尋ねたかにかかわらず、誤バージョンとして検出されることがない。検査が引用を誤バージョンとして検出できるのは、尋ねられたバージョンにその ID がなく、かつ別のバージョンにはある場合に限られる。索引も影響する。別のバージョンへの引用が起こりうるのは、そのバージョンの節が、回答の生成に使われた索引に含まれている場合だけである。したがって索引が変わるたびに件数を読み直す必要があり、古い索引でのゼロは新しい索引について何も語らない。

ここでは二つの変種を読む。ベースラインは、尋ねられたバージョンの索引だけから検索する。無フィルタ変種は、すべてのバージョンの索引をまとめて検索し、各節の見出しにそのバージョンを表示するため、モデルは節の出どころを確認できる。他のバージョンの節が提示されるので、別バージョンを引用しうるのは無フィルタ変種のほうである。

version-correct-answers.py Python 3.12.15 · numpy 2.5.5 · pydantic 2.14.3 · typing-extensions 4.16.0 合格
"""Reads the 25 version-dependent items for two variants: whether the judge passed the answer for the asked version, and whether acitation names a section that exists only in another version.The judge's verdict for each variant is read from its own recording, and an unreadable verdict is printed and left out of thepass rate, never counted as a fail. A declined reply has a verdict like any other reply, so it stays in the denominator; itscount is printed beside each rate. A wrong-version citation is counted per item, over every item, so a zero shows as 0 of 25.The last lines list the items where the two variants disagree, to read item by item."""import lib  # first: fixes the thread counts and seeds before anything else loadsfrom lib.calibration import readable_verdictsfrom lib.contract import citation_outcomes, parse_reply, section_ids_by_versionfrom lib.prompts import P1_SHA256, REF_SHA256from lib.replay import ReplayModelfrom lib.stats import pctfrom lib.testset import load_itemsids = section_ids_by_version()  # every version's section IDs, so a section of another version is known as one# label, the assistant's recording, the judge's recording of that assistant's repliesVARIANTS = (("baseline", "assistant-baseline", "judge-answers-baseline"), ("unfiltered", "assistant-unfiltered", "judge-answers-unfiltered"))items = [item for item in load_items() if item.kind == "version-dependent"]item_ids = [item.id for item in items]listed = {item.id: frozenset(s.section_id for s in item.supporting_sections if s.version == item.version) for item in items}verdict, wrong = {}, {}  # label -> {item id: PASS or FAIL, readable only}; label -> item ids with a wrong-version citationfor label, assistant, judge in VARIANTS:    verdict[label], unreadable = readable_verdicts(judge, item_ids, REF_SHA256)    for item_id, first in unreadable:        print(f'{label} unreadable verdict, left out: {item_id} ("{first}")')    replies = ReplayModel(assistant, P1_SHA256)    wrong[label] = {item.id for item in items                    if "wrong-version" in citation_outcomes(parse_reply(replies.reply(item.id, 0)), item.version, listed[item.id], ids)}    for split in ("dev", "held-out"):        split_items = [item for item in items if item.split == split]        readable = [item.id for item in split_items if item.id in verdict[label]]        passed = sum(verdict[label][item_id] == "PASS" for item_id in readable)        print(f"{label} {split} version-dependent items: {len(split_items)}")        print(f"{label} {split} declined replies, counted in the denominator: "              f"{sum(parse_reply(replies.reply(item.id, 0)).declined for item in split_items)}")        print(f"{label} {split} judged correct for the asked version: {pct(passed, len(readable))}")        print(f"{label} {split} citing a wrong-version section: "              f"{pct(sum(item.id in wrong[label] for item in split_items), len(split_items))}")    print(f"{label} all version-dependent items citing a wrong-version section: {pct(len(wrong[label]), len(items))}")both = [item_id for item_id in item_ids if item_id in verdict["baseline"] and item_id in verdict["unfiltered"]]print(f"items with a readable verdict in both variants: {len(both)}")differ = [i for i in both if verdict["baseline"][i] != verdict["unfiltered"][i]]print(f"items where the verdicts differ: {len(differ)}")print("  " + (", ".join(differ) or "none"))flag_differ = [i for i in item_ids if (i in wrong["baseline"]) != (i in wrong["unfiltered"])]print(f"items where the wrong-version flag differs: {len(flag_differ)}")print("  " + (", ".join(flag_differ) or "none"))
出力python version-correct-answers.py
baseline dev version-dependent items: 17
baseline dev declined replies, counted in the denominator: 4
baseline dev judged correct for the asked version: 64.7% (11 of 17)
baseline dev citing a wrong-version section: 0.0% (0 of 17)
baseline held-out version-dependent items: 8
baseline held-out declined replies, counted in the denominator: 2
baseline held-out judged correct for the asked version: 75.0% (6 of 8)
baseline held-out citing a wrong-version section: 0.0% (0 of 8)
baseline all version-dependent items citing a wrong-version section: 0.0% (0 of 25)
unfiltered dev version-dependent items: 17
unfiltered dev declined replies, counted in the denominator: 5
unfiltered dev judged correct for the asked version: 52.9% (9 of 17)
unfiltered dev citing a wrong-version section: 0.0% (0 of 17)
unfiltered held-out version-dependent items: 8
unfiltered held-out declined replies, counted in the denominator: 2
unfiltered held-out judged correct for the asked version: 75.0% (6 of 8)
unfiltered held-out citing a wrong-version section: 0.0% (0 of 8)
unfiltered all version-dependent items citing a wrong-version section: 0.0% (0 of 25)
items with a readable verdict in both variants: 25
items where the verdicts differ: 6
  q-0003, q-0021, q-0022, q-0033, q-0082, q-0085
items where the wrong-version flag differs: 0
  none

すべてのバージョン依存項目を通した誤バージョンの割合は、ベースラインで 0.0% (0 of 25)、無フィルタ変種で 0.0% (0 of 25) である。ゼロが示すのは、検査が ID を一つも検出しなかったということだけである。次の例は、検査が検出しえた ID がいかに少なかったかを示す。

version-check-detail.py Python 3.12.15 · numpy 2.5.5 · pydantic 2.14.3 · typing-extensions 4.16.0 合格
"""The two counts behind the version check, and the version-dependent items where the variants' verdicts differ, by split.A wrong-version citation is one whose ID exists only in another version, so an ID that several versions share cannot beattributed to one of them. This prints how many section IDs are found in one version only, then how many citations to theversion-dependent items name a shared ID, for each variant. The last lines list the items where the verdicts differ, by split."""import lib  # first: fixes the thread counts and seeds before anything else loadsfrom collections import Counterfrom lib.calibration import readable_verdictsfrom lib.contract import parse_reply, section_ids_by_versionfrom lib.prompts import P1_SHA256, REF_SHA256from lib.replay import ReplayModelfrom lib.stats import pctfrom lib.testset import load_itemsids = section_ids_by_version()shared = Counter(i for found in ids.values() for i in found)  # how many versions each section ID appears inprint("section IDs found in one version only, by version: "      + ", ".join(f"{v} {sum(shared[i] == 1 for i in found)}" for v, found in ids.items()))items = [item for item in load_items() if item.kind == "version-dependent"]split_of = {item.id: item.split for item in items}verdict = {}  # label -> {item id: PASS or FAIL}, readable onlyfor label, assistant, judge in (("baseline", "assistant-baseline", "judge-answers-baseline"),                                ("unfiltered", "assistant-unfiltered", "judge-answers-unfiltered")):    replies = ReplayModel(assistant, P1_SHA256)    cited = [cid for item in items for cid in parse_reply(replies.reply(item.id, 0)).citations]    print(f"{label} citations to a section ID found in more than one version: "          f"{pct(sum(shared[cid] > 1 for cid in cited), len(cited))}")    verdict[label], _ = readable_verdicts(judge, list(split_of), REF_SHA256)differ = [i for i in verdict["baseline"] if i in verdict["unfiltered"] and verdict["baseline"][i] != verdict["unfiltered"][i]]for split in ("dev", "held-out"):    part = [i for i in differ if split_of[i] == split]    print(f"{split} items where the verdicts differ: {len(part)}")    print("  " + (", ".join(part) or "none"))
出力python version-check-detail.py
section IDs found in one version only, by version: 1.0 0, 1.1 0, 2.0 4
baseline citations to a section ID found in more than one version: 87.0% (20 of 23)
unfiltered citations to a section ID found in more than one version: 63.2% (12 of 19)
dev items where the verdicts differ: 4
  q-0003, q-0021, q-0022, q-0033
held-out items where the verdicts differ: 2
  q-0082, q-0085

一つのバージョンにしか現れない節 ID をバージョン別に数えると 1.0 0, 1.1 0, 2.0 4 である。複数のバージョンに現れる ID も検出されうるが、それは、その ID を持たないバージョンの読者に対してだけである。ベースラインでは、バージョン依存項目への引用のうち共有 ID を指すものの割合は 87.0% (20 of 23) である。無フィルタ変種では 63.2% (12 of 19) である。

正答判定率には差があるが、いずれも小さな分割で読んだ値である。dev では、ベースラインが正答と判定されたのは 64.7% (11 of 17) である。

無フィルタ変種が正答と判定されたのは 52.9% (9 of 17) である。これらの項目では、無フィルタ変種のほうが合格数は少ない。

held-out では、ベースラインが正答と判定されたのは 75.0% (6 of 8) である。無フィルタ変種も同じ率だが、合格する項目は異なる。q-0082 と q-0085 では判定が逆の向きに分かれ、held-out のその他の項目では一致している。

二つの変種を通して、判定が分かれるのは 6 件であり、これは両方で判定を読み取れた 25 件のうちの数である。dev では 4 件、held-out では 2 件が分かれる。出力では、これらが分割ごとに列挙される。

これらの差については区間を計算しておらず、この規模の dev 分割は小さい。そのため本章では件数を報告するにとどめ、どちらの変種が優れているとも劣っているとも述べない。件数から言えるのは次の三点である。これらの項目では無フィルタ変種の合格数が少なかったこと、どちらの変種でも誤バージョンとして検出された引用がなかったこと、そして判定が分かれた項目が最初に読むべき場所であることである。

実践ルール: 各引用の ID は、その回答のバージョンと並べて読む。この検査でのゼロは、検出された ID がないことを意味し、誤バージョンの引用がないことを意味しない。バージョン依存項目は合格率の隣に専用の件数として分けて持ち、バージョンの取りこぼしが独立した行に現れるようにする。

結果と経路

結果とは、返答が合格したかどうかである。経路とは、返答に至るまでの各ステップが何に到達したかである。本書では経路は短く、検索が1回あり、続いて返答が1回ある。結果と経路を組み合わせた場合のうち、2つは両方の数え方を必要とする。裏付けとなる節がモデルに届かなかったのに合格した場合、その返答は別の場所、たとえばモデル自身の知識から来たものであり、判定が正しくても警告として扱う。節が検索されたのに不合格となる場合は、他の検査がその原因を説明するために存在しているケースである。

複数のステップを含む実行では、経路はより長くなる。Agent Harnessesはタスクを経路によって数えており、それについてはその本を読むとよい。この章で採点するのは、アシスタントが持つ1つのステップである。

検索の段階

検索は、質問された版の各節に対する BM25 である。これは決定的であり、同じ質問には毎回同じ上位の節が返る。したがって、この段階には記録が要らない。コードは各項目の上位の節を索引から計算し、それをベースラインの回答に対して判定器が下した判定と突き合わせる。

質問された版に裏付けとなる節がない開発用項目は、表から除く。これらは回答不能な項目であり、質問された版の節が存在しないため、検索で見つけられるものがない。その件数は 13 である。

retrieval-path.py Python 3.12.15 · bm25s 0.3.16 · numpy 2.5.5 · pydantic 2.14.3 · typing-extensions 4.16.0 合格
"""Sets the baseline's judge verdict against whether a supporting section reached the top k, for each dev item that has one.Retrieval is BM25 over the asked version, so it is the same on every run and needs no recording; k is the baseline's, read fromits manifest. The two diagonal cells are the expected pairs. The two off-diagonal cells are the ones to read: a pass without theright section retrieved, and a fail with it retrieved. Unanswerable items are left out, since they have no section of their askedversion to retrieve; their count is printed. An unreadable verdict is printed and left out, never counted as a fail. A declined reply is counted in its cell like anyother reply; the count of declines is printed. The FAIL cell is split into declines and answers in fail-with-section."""import lib  # first: fixes the thread counts and seeds before anything else loadsfrom lib.answers import Assistantfrom lib.calibration import readable_verdictsfrom lib.contract import parse_replyfrom lib.prompts import P1_SHA256, P1_SYSTEM, REF_SHA256from lib.replay import ReplayModelfrom lib.testset import load_itemsRECORDING = "assistant-baseline"k = ReplayModel(RECORDING, P1_SHA256).manifest["k"]  # the top k the baseline's prompt was built from, read from its manifestassistant = Assistant(RECORDING, P1_SYSTEM, P1_SHA256, k=k)  # its retriever only; the recording is not read herereplies = ReplayModel(RECORDING, P1_SHA256)  # the baseline's replies, sample 0, made from prompt P1, for the decline checkdev = load_items(split="dev")has_support = [item for item in dev if any(s.version == item.version for s in item.supporting_sections)]print(f"top k: {k}")print(f"dev items: {len(dev)}")print(f"dev items with no supporting section of the asked version, left out: {len(dev) - len(has_support)}")verdicts, unreadable = readable_verdicts("judge-answers-baseline", [item.id for item in has_support], REF_SHA256)for item_id, first in unreadable:    print(f'unreadable verdict, left out: {item_id} ("{first}")')# Keyed by (retrieved, passed): the four cells of the 2 by 2 table, each a list of item ids in sorted order.cells = {(True, True): [], (True, False): [], (False, True): [], (False, False): []}declined = set()  # item ids whose reply is a decline; they sit in their cells like any other replyfor item in has_support:    if item.id not in verdicts:        continue    listed = {s.section_id for s in item.supporting_sections if s.version == item.version}    top = {section.section_id for section in assistant.sections(item)}  # the top k sections, by BM25 rank    cells[(bool(listed & top), verdicts[item.id] == "PASS")].append(item.id)    if parse_reply(replies.reply(item.id, 0)).declined:        declined.add(item.id)print(f"items in the table: {sum(len(ids) for ids in cells.values())}")print(f"declined items in the table, counted in their cells: {len(declined)}")print(f"right section in the top {k}, PASS: {len(cells[(True, True)])}")print(f"right section in the top {k}, FAIL: {len(cells[(True, False)])}")print(f"right section not in the top {k}, PASS: {len(cells[(False, True)])}")print(f"right section not in the top {k}, FAIL: {len(cells[(False, False)])}")print("passed without the right section retrieved: " + (", ".join(cells[(False, True)]) or "none"))print("failed with the right section retrieved: " + (", ".join(cells[(True, False)]) or "none"))
出力python retrieval-path.py
top k: 3
dev items: 80
dev items with no supporting section of the asked version, left out: 13
unreadable verdict, left out: q-0043 ("VERDICT: PARTIAL")
items in the table: 66
declined items in the table, counted in their cells: 10
right section in the top 3, PASS: 49
right section in the top 3, FAIL: 10
right section not in the top 3, PASS: 0
right section not in the top 3, FAIL: 7
passed without the right section retrieved: none
failed with the right section retrieved: q-0019, q-0023, q-0025, q-0029, q-0033, q-0045, q-0046, q-0048, q-0063, q-0074

上位 k は 3 であり、ベースラインのマニフェストから読み取った。表には 66 件の項目があり、そのうち 10 件は回答の辞退である。辞退にも判定器が判定を与えているため、辞退は他の回答と同じようにセルに入る。各セルは、判定と、裏付けとなる節が上位 k に入ったかどうかを組み合わせたものである。

判定 裏付けとなる節が上位 k にある 裏付けとなる節が上位 k にない
PASS 49 0
FAIL 10 7

まず PASS の行を読む。節が上位 k にある合格のセルには 49 件、ない合格のセルには 0 件が入っている。これは、合格がドキュメントに由来することと矛盾しない。ただし、由来したことを示すものではない。この表が数えているのは二つの事柄が同時に起こる頻度であり、どちらが原因かではないからである。合格の件数は、参照回答の検査にもなる。節が検索されていない合格は、よく知られた事実を繰り返す回答からも、読み手が推測できる参照回答からも生じうるが、表はそのどちらかを教えない。それは、これらの項目を読めば分かる。

FAIL の行では、他の検査が関わってくる。節が上位 k にある不合格のうち、5 件は辞退であり、残りは回答である。ドキュメントに答えがあるときに辞退が何を意味するかは、ドキュメントに記載がないときの辞退で扱う。次の例は、このセルを分けて示す。

fail-with-section.py Python 3.12.15 · bm25s 0.3.16 · numpy 2.5.5 · pydantic 2.14.3 · typing-extensions 4.16.0 合格
"""The dev items the baseline failed although a listed section of the asked version was in its top k, split into declines and answers.For each answer it prints whether the reply cites a listed section, and the faithfulness judge's verdict on it. A decline has nofaithfulness verdict, because the judge reads only answers. An unreadable verdict is printed and left out, never counted as a fail."""import lib  # first: fixes the thread counts and seeds before anything else loadsimport refrom lib.answers import Assistantfrom lib.calibration import readable_verdictsfrom lib.contract import citation_outcomes, parse_reply, section_ids_by_versionfrom lib.prompts import FAITH_SHA256, P1_SHA256, P1_SYSTEM, REF_SHA256from lib.replay import ReplayModelfrom lib.testset import load_itemsRECORDING = "assistant-baseline"k = ReplayModel(RECORDING, P1_SHA256).manifest["k"]  # the baseline's top k, as in retrieval-pathassistant = Assistant(RECORDING, P1_SYSTEM, P1_SHA256, k=k)  # its retriever onlyreplies = ReplayModel(RECORDING, P1_SHA256)  # the baseline's replies, sample 0, made from prompt P1faith = ReplayModel("judge-faithfulness-baseline", FAITH_SHA256)ids = section_ids_by_version()VERDICT = re.compile(r"^VERDICT:\s*(SUPPORTED|UNSUPPORTED)$")def listed(item):    """The item's supporting section IDs in its asked version."""    return frozenset(s.section_id for s in item.supporting_sections if s.version == item.version)dev = load_items(split="dev")verdicts, unreadable = readable_verdicts("judge-answers-baseline", [item.id for item in dev], REF_SHA256)for item_id, first in unreadable:    print(f'unreadable verdict, left out: {item_id} ("{first}")')fails = [item for item in dev if verdicts.get(item.id) == "FAIL" and listed(item) & {s.section_id for s in assistant.sections(item)}]declined = [item for item in fails if parse_reply(replies.reply(item.id, 0)).declined]answered = [item for item in fails if item not in declined]print(f"right section in the top {k}, FAIL, declined: {len(declined)}")print(f"right section in the top {k}, FAIL, answered: {len(answered)}")print(f"answered FAIL with the section, citing a listed section: "      f"{sum('supported' in citation_outcomes(parse_reply(replies.reply(item.id, 0)), item.version, listed(item), ids) for item in answered)}")judged = {}  # item id -> SUPPORTED, UNSUPPORTED or unreadable, for each answered failfor item in answered:    line = next((ln.strip().strip("*`").strip() for ln in faith.reply(item.id, 0).splitlines() if ln.strip()), "")    match = VERDICT.match(line)    judged[item.id] = match.group(1) if match else "unreadable"print(f"answered FAIL with the section, faithfulness SUPPORTED: {sum(v == 'SUPPORTED' for v in judged.values())}")print(f"answered FAIL with the section, faithfulness UNSUPPORTED: {sum(v == 'UNSUPPORTED' for v in judged.values())}")print("  " + (", ".join(i for i, v in judged.items() if v == "UNSUPPORTED") or "none"))print(f"answered FAIL with the section, faithfulness unreadable: {sum(v == 'unreadable' for v in judged.values())}")
出力python fail-with-section.py
unreadable verdict, left out: q-0043 ("VERDICT: PARTIAL")
right section in the top 3, FAIL, declined: 5
right section in the top 3, FAIL, answered: 5
answered FAIL with the section, citing a listed section: 5
answered FAIL with the section, faithfulness SUPPORTED: 4
answered FAIL with the section, faithfulness UNSUPPORTED: 1
  q-0029
answered FAIL with the section, faithfulness unreadable: 0

回答した不合格のうち、5 件は項目が挙げる節を引用している。忠実性の判定器はそのうち 4 件を合格とし、1 件を裏付けなしとしている。後者は q-0029 である。ここでの件数からは、残りが誤った辞退、版の取り違え、回答の判定器の誤りのいずれによるものかは分からない。それは、回答を読めば分かる。

判定の一つは、PASS でも FAIL でもなく PARTIAL である。q-0043 に対する判定器の判定は PARTIAL であるため、表からは除いてある。読み取れない判定を不合格として数えることはない。

実践ルール: 検索は、合格に対する関門として、また不合格に対する手がかりとして扱う。裏付けとなる節のない合格には説明が必要であり、節がある不合格は回答そのものを指し示す。

エージェントハーネスが引き継ぐ範囲

複数のステップからなるタスクでは、各ステップがツールを呼び出し、次のステップが目にするものを変える場合がある。結果が合格となっても途中のステップで誤りが生じていることがあり、そのため経路全体にわたって数え上げる必要がある。本書で採点するのは1回の検索と1回の応答であるから、経路の数え上げは項目ごとの可否の判定になる。経路を通して数え上げるタスクをどのように採点するかについては、Agent Harnessesの節で扱っており、この章では繰り返さない。

実践ルール: 本書では経路は1回の検索と1回の応答であるため、項目ごとに検索の数え上げを判定結果と並べて読むこと。

この部分はまだ翻訳されていないため、英語で表示している。

Retrieval quality belongs to another book

最終変更:版2026.11.3

How well retrieval orders the sections, and how much of the context it fills, is a question about ranking, and it belongs to A Primer on Search Relevance. Its choosing a ranking metric section covers recall at k, mean reciprocal rank and nDCG, and how to choose among them. Measuring the context covers the context a model is given. Read both before you pick a metric for this assistant.

The retrieval-path count asks one question of each item: is a supporting section of the asked version in the top k? It returns yes or no, so it is not a ranking metric. It cannot say how far down the list that section sits, and that is what a ranking metric is for. Its k is read from the baseline's manifest and is not chosen in this chapter, so a change to k moves the table, and the table has to be read again.

Taken together, the four checks say that a pass rate on this assistant hides three different ways of being wrong. The reply can cite the wrong thing, state what no section says, or answer for the wrong version. Each one needs its own count, its own denominator and its own word for what it found. The decisions that follow from the results are these:

  • Each reply is checked for citations, faithfulness and version, and each check keeps its own count.
  • Every faithfulness rate is printed as uncalibrated until someone checks the judge against people.
  • Version-dependent items keep their own count beside the pass rate, and their own version check.
  • Retrieval is a gate on passes and a lead on fails. A pass whose section was not retrieved is read before it is counted as grounded.

Working rule: Before you call a reply grounded, read its citation, its claims and its version, and read the retrieval that came before it.

この版における本章

第2026.11.3版2026年11月21日時点で例が通過この章の6 例件のうち6件が合格

英語版の書籍(版2026.11.3)から翻訳した。

この節を引用する

形式

いずれの形式も、本訳書が従う英語版の書籍を出典として示す。

いずれの形式もこの版を明示している。そのリンクは現行版を開き、節の見出しには本文が最後に変更された日付が示される。アクセス日と取得日は、これを開いた日である。

このページの内容

全11章中の第9章: 回答が引用された文書に基づき、問われたバージョンに沿っていることを確認する

  1. ここでいう「根拠がある」とは
  2. 引用の正確さ
  3. 忠実性
  4. バージョン正確性
  5. 結果と経路
  6. 検索の段階
  7. エージェントハーネスが引き継ぐ範囲
  8. Retrieval quality belongs to another book

ページの先頭に戻るすべての章