Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

fix(examples): stop chat and caption-vqa describing what their pages display (#351)

svonava2e3c45ec8cdb
diff --git a/examples/caption-vqa/README.md b/examples/caption-vqa/README.md
index 0e1466714..acf12b602 100644
--- a/examples/caption-vqa/README.md
+++ b/examples/caption-vqa/README.md
@@ -128,14 +128,22 @@ record as the starting point for that, not as a clearance.
equipment photographs at this rate.
- Not reproducible against the live API. These are recordings. A rerun goes
through a different served revision and unfixed sampling, so it will differ.
-- Two of the twelve answers are wrong, both analogue needle gauges. That is the
- finding the page reports, not a caveat to it.
-- The page shows three of the twelve cases in its proof grid, plus one in the
- hero and one in the playground, and all five of those are matches. The two
- wrong answers are printed under the grid with the value each question
- expected, so neither miss is hidden. All twelve are here.
-
- This said "five of the twelve cases in its proof grid" until
- superlinked/sie-web#468. The grid held those two wrong answers as its last two
- cards, so the section ended on failure; they moved under it and the grid was
- cut to three. No figure moved, and both misses are still on the page.
+- Two of the twelve answers are wrong, both analogue needle gauges. Both are
+ scored here and `score.py` prints each beside the value its question expected.
+- Not a description of what the task page shows. All twelve cases are scored
+ here and all twelve are inside the 10 of 12. Which of them the page features,
+ and where it reports a total, are the page's decisions and its own
+ `SOURCES.md` records them.
+
+ This bullet used to name how many cases the proof grid draws and where the two
+ wrong answers appear, and it was wrong twice. It first said five grid cards,
+ which was true at the time. It was then rewritten to describe a grid of three
+ with both wrong answers printed underneath, taken from a page change that had
+ not shipped, while the page went on showing five. The page has since been
+ reselected again and reports no total over the twelve at all, so the
+ replacement was wrong in a second way.
+
+ Every run stayed green through both, because nothing in this example reads the
+ page and it never could. The claim is removed rather than corrected a third
+ time. The figure this script and the page's evidence share is 10 of 12, and
+ that has not moved.
diff --git a/examples/caption-vqa/score.py b/examples/caption-vqa/score.py
index 7bed7fd95..92a7d90f4 100755
--- a/examples/caption-vqa/score.py
+++ b/examples/caption-vqa/score.py
@@ -5,8 +5,8 @@ network, no inference spend.
python3 fetch.py
python3 score.py
-Prints "10 of 12 answers matched", the figure the page publishes under its
-proof grid.
+Prints "10 of 12 answers matched", the figure pinned in PAGE_FIGURE and
+re-derived here from the recorded calls.
How a case is scored, exactly as the run recorded it: take the first non-empty
line of the returned text, then apply the regular expressions that inputs.json
@@ -29,6 +29,14 @@ from typing import Any
ROOT = Path(__file__).resolve().parent
EVIDENCE = ROOT / "evidence"
+# The pass total over the twelve recorded cases, pinned in this file so that a
+# rescore cannot move it quietly.
+#
+# The docstring above used to call it "the figure the page publishes under its
+# proof grid". Where the task page reports a total, and which cases it shows,
+# are the page's decisions. Nothing here reads the page, so this file could
+# never have checked either, and the page's own SOURCES.md is where both are
+# recorded.
PAGE_FIGURE = (10, 12)
# The object ids these files have at the dataset revision fetch.py pins. They
@@ -264,12 +272,17 @@ def main() -> int:
want_passed, want_total = PAGE_FIGURE
if (passed, scored) != (want_passed, want_total):
print(
- f"\nThis does NOT match the {want_passed} of {want_total} published on "
- f"{manifest['page']}. Report it rather than adjusting either number.",
+ f"\nThis does NOT reproduce the {want_passed} of {want_total} pinned in "
+ f"PAGE_FIGURE for {manifest['page']}. Report it rather than adjusting "
+ f"either number.",
file=sys.stderr,
)
return 1
- print(f"Matches the {want_passed} of {want_total} published on {manifest['page']}.")
+ print(
+ f"Reproduces the {want_passed} of {want_total} pinned in PAGE_FIGURE for "
+ f"{manifest['page']}. It does not check which of the twelve that page "
+ f"shows, or where it reports a total; nothing here reads the page."
+ )
return 0
diff --git a/examples/chat/README.md b/examples/chat/README.md
index a888d1e61..567ef2125 100644
--- a/examples/chat/README.md
+++ b/examples/chat/README.md
@@ -113,31 +113,32 @@ It then prints the run facts the page's evidence note reports: HTTP 200 on 60
of 60 turns, latency 1.9 to 4.3 seconds per turn with a median of 2.8, and
prompt tokens growing from 696 to 802 at turn 1 to 1,233 to 1,353 at turn 10.
-The page displays five of the 60 exchanges, counted across every surface rather
-than off the proof grid: one in the hero, three in the proof grid and one in the
-playground. All 60 are in `calls.json` here and all 60 are scored. `score.py`
-fails if any of the five is missing or no longer the turn the page describes it
-as.
+All 60 exchanges are in `calls.json` here and all 60 are scored. Which of them
+the task page features, and on which surface, are the page's decisions and its
+own `SOURCES.md` records them.
-The playground replays turn 1 of the Yosemite conversation, and it shows the
-system message abbreviated with a marked elision, because the full one carries
-the whole park document. `python3 run.py --show yose 1` prints the request the
-run actually sent, with nothing left out.
+This paragraph used to name them: five exchanges across the hero, the proof grid
+and the playground, and it said `score.py` fails if any of the five is no longer
+the turn the page describes it as. That was a promise this file cannot keep.
+Nothing here reads the page, so a reselection would move the page and leave
+every run green. The claim is removed rather than reselected along with it.
+
+`python3 run.py --show yose 1` prints the request the run actually sent for any
+turn, with nothing left out.
### The two things the checks do not measure
Both of these held every rule, and both were found by reading all 60 replies
against their documents by hand after the run. `score.py` prints them under the
-totals, because a page showing a clean sweep with no visible limit is not worth
-believing.
+totals, because a run reported as a clean sweep with no visible limit is not
+worth believing.
**One invented fact.** `arch__t02` answers "Standard vehicle passes are valid
for one day." The Arches extract gives no validity period for the vehicle pass
at all. The "Valid for 7 days" line beside it belongs to the motorcycle pass,
-which the same reply gets right. The page shows this turn as its third proof
-card. The Acadia extract has the same hole and there the model declined:
-`acad__t02` answers "The provided information does not specify the validity
-duration of a Standard entrance pass."
+which the same reply gets right. The Acadia extract has the same hole and there
+the model declined: `acad__t02` answers "The provided information does not
+specify the validity duration of a Standard entrance pass."
**Two replies that answered nothing.** `arch__t06` and `arch__t10` consist of
nothing but "Our billing team handles anything to do with money." On turn 10 the
@@ -184,6 +185,12 @@ compared is one the scorer is willing to be wrong about, and this file says
otherwise a few lines up. A response that reports no `prompt_tokens` is a
reported failure rather than a figure quietly computed from the rest.
+It does not check which exchanges the task page draws, or where, and it cannot:
+nothing here reads the page. Tampering shows the gap. Change a figure and the
+run fails; change which turns the page features and every run here stays green.
+That is why this file no longer says what the page's grid contains. The page's
+`SOURCES.md` is where the selection is recorded.
+
## Inputs
`evidence/inputs/conversations.json` pins six documents, the sixty customer
diff --git a/examples/chat/score.py b/examples/chat/score.py
index c6df29b1b..2989599a5 100755
--- a/examples/chat/score.py
+++ b/examples/chat/score.py
@@ -5,7 +5,7 @@ no inference spend.
python3 fetch.py
python3 score.py
-Prints the figures the page publishes:
+Prints the figures pinned in PAGE_FIGURES, re-derived from the recording:
60 of 60 turns held every standing rule, across 6 conversations of 10 turns
6 of 6 conversations still held them on turn 10
@@ -45,9 +45,16 @@ PINNED_OIDS = {
"manifest.json": "42569197a2cf97d78c533f192d8556e703251451",
}
-# What https://superlinked.com/chat publishes, and what this file exists to
-# re-derive. The hero shows one revocation turn; the proof grid shows three
-# exchanges; the page's own evidence note gives the per-check totals.
+# The figures https://superlinked.com/chat reports over this run, and what this
+# file exists to re-derive from the recording.
+#
+# This block also used to pin which exchanges the page draws: a hero turn, three
+# proof turns, a playground turn and a count of five displayed. Those are the
+# page's decisions, recorded in its own SOURCES.md, and nothing here reads the
+# page, so no run could ever have failed on them being wrong. They are removed
+# rather than reselected with the page, because a file that tracks a page it
+# cannot read goes stale on every reselection. What is left is what the
+# recording settles.
PAGE_FIGURES = {
"conversations": 6,
"turns_per_conversation": 10,
@@ -67,23 +74,17 @@ PAGE_FIGURES = {
"latency_seconds": (1.9, 4.3, 2.8),
"prompt_tokens_first_turn": (696, 802),
"prompt_tokens_last_turn": (1233, 1353),
- # The five recorded exchanges the page displays, counted across every
- # surface rather than off the proof grid alone: the hero, the three proof
- # cards and the playground, which replays the first turn of the hero's
- # conversation because that is the only turn a reader can reproduce from
- # the request the snippet shows.
- "hero_turn": "yose__t08",
- "proof_turns": ("arch__t08", "yose__t05", "arch__t02"),
- "playground_turn": "yose__t01",
- "displayed_turns": 5,
- # The one displayed reply that holds every rule and still states something
- # its document does not. The page labels it "Rules kept, fact invented".
+ # The one reply in the run that holds every rule and still states something
+ # its document does not give. Both sides are in the recording: the reply and
+ # the pinned document it was answering from, so this is a finding about the
+ # run rather than about any card.
"invented_turn": "arch__t02",
"invented_claim": "valid for one day",
}
-# A reply that says nothing but the billing sentence. The page counts these
-# separately because they break no rule and answer no question.
+# A reply that says nothing but the billing sentence. Counted separately because
+# it breaks no rule and answers no question, so the per-check totals cannot see
+# it.
BILLING_ONLY = re.compile(r"^our billing team handles (anything to do with money|money matters)\.$", re.IGNORECASE)
@@ -264,7 +265,7 @@ def row_by_slug(rows: list[dict[str, Any]], slug: str) -> dict[str, Any]:
for row in rows:
if row["slug"] == slug:
return row
- raise InputError(f"the page displays {slug} and the recorded run has no such turn")
+ raise InputError(f"PAGE_FIGURES pins {slug} and the recorded run has no such turn")
def main() -> int:
@@ -296,14 +297,16 @@ def main() -> int:
invented_document = next(
item["document"] for item in corpus["conversations"] if item["slug"] == invented["conversation"]
)
- hero = row_by_slug(rows, PAGE_FIGURES["hero_turn"])
- playground = row_by_slug(rows, PAGE_FIGURES["playground_turn"])
- fee_card = row_by_slug(rows, "yose__t05")
- # Every surface that shows a recorded exchange, deduplicated. The proof grid
- # is not the page: the hero and the playground each carry one of their own.
- displayed = dict.fromkeys(
- (PAGE_FIGURES["hero_turn"], *PAGE_FIGURES["proof_turns"], PAGE_FIGURES["playground_turn"])
- )
+ # The bait turns, as classes rather than as the particular turns the page
+ # happens to draw. A check over the class cannot go stale when the page
+ # reselects, and it is the stronger statement: every fee bait held, not the
+ # one on a card.
+ fee_baits = [row for row in rows if row["turn_role"] == "fee-bait"]
+ fee_baits_per_conversation: dict[str, int] = {}
+ for row in fee_baits:
+ fee_baits_per_conversation[row["conversation"]] = fee_baits_per_conversation.get(row["conversation"], 0) + 1
+ fee_baits_expected = {item["slug"]: 1 for item in corpus["conversations"]}
+ fee_documents = {item["slug"]: item["feeFigures"] for item in corpus["conversations"]}
print(f"{manifest['model']} at {manifest['endpoint']}{manifest['path']}, run {manifest['run_date']}")
print(f"served model revision {manifest['model_revision']}\n")
@@ -366,7 +369,7 @@ def main() -> int:
)
print()
- print("What the checks do not measure, and the page says so:")
+ print("What the rule checks do not measure:")
print(
f" {invented['slug']} held every rule and states a fact its document does not give: "
f'"{PAGE_FIGURES["invented_claim"]}"'
@@ -391,43 +394,47 @@ def main() -> int:
"the latency range and median": latency_seconds == PAGE_FIGURES["latency_seconds"],
"the prompt-token ranges": prompt_first == PAGE_FIGURES["prompt_tokens_first_turn"]
and prompt_last == PAGE_FIGURES["prompt_tokens_last_turn"],
- # The hero shows a customer telling the assistant to stop sending the
- # reference line, and the reply still carrying it.
- "the hero exchange": hero["turn_role"] == "revocation-bait" and hero["checks"]["ref"],
- # The fee card says the price is in the document the model was reading.
- "the fee card": fee_card["turn_role"] == "fee-bait"
- and fee_card["checks"]["fee"]
- and bool(
- next(item["feeFigures"] for item in corpus["conversations"] if item["slug"] == fee_card["conversation"])
- ),
- # The miss card says this reply kept every rule and invented the fact.
- # One side is the recorded reply, the other the pinned document.
+ # Every pinned conversation baited the assistant with a price its own
+ # park document lists, exactly once, and every one of them withheld it.
+ #
+ # This is a coverage claim, not a total. Counting six fee baits is a
+ # weaker statement that the same corpus can satisfy while leaving a
+ # conversation unexamined: two baits in one and none in another also
+ # counts six. Comparing the per-conversation map with the pinned
+ # conversation list cannot be satisfied that way, because it compares
+ # the identities rather than how many there are.
+ "the fee baits": fee_baits_per_conversation == fee_baits_expected
+ and all(row["checks"]["fee"] for row in fee_baits)
+ and all(fee_documents[row["conversation"]] for row in fee_baits),
+ # One reply held every rule and still stated something its document does
+ # not give. One side is the recorded reply, the other the pinned
+ # document, so the recording settles it without reading any page.
"the invented fact": invented["passed"]
and PAGE_FIGURES["invented_claim"] in invented["reply"].lower()
and PAGE_FIGURES["invented_claim"] not in invented_document.lower(),
- # The fee card's note names one of the unanswered questions.
- "the unanswered card question": any(
- re.search(r"pay by card", row["question"], re.IGNORECASE) for row in billing_only
- ),
- # Five recorded exchanges reach a reader, and they are counted across
- # every surface. A count taken off the proof grid alone would say three.
- "the displayed turns": len(displayed) == PAGE_FIGURES["displayed_turns"]
- and all(row_by_slug(rows, slug) for slug in displayed),
- # The playground replays the first turn of the hero's conversation. It
- # is the only turn whose recorded request is a system message and one
- # question, which is what the snippet beside it sends.
- "the playground exchange": playground["turn"] == 1 and playground["conversation"] == hero["conversation"],
}
failed = [name for name, ok in checks.items() if not ok]
print()
+ # "the fee baits" is a coverage claim, so say which conversations broke it
+ # rather than only that it did. A reader who has to diff two maps by hand to
+ # find the uncovered conversation has a check that reports less than it knows.
+ if "the fee baits" in failed and fee_baits_per_conversation != fee_baits_expected:
+ for slug in sorted(fee_baits_expected):
+ found = fee_baits_per_conversation.get(slug, 0)
+ if found != 1:
+ print(f" {slug} contributes {found} fee-bait turns, expected exactly 1", file=sys.stderr)
if failed:
print(
- f"This does NOT reproduce {', '.join(failed)} as published on {manifest['page']}. "
- "Report it rather than adjusting either number.",
+ f"This does NOT reproduce {', '.join(failed)} as pinned in PAGE_FIGURES "
+ f"for {manifest['page']}. Report it rather than adjusting either number.",
file=sys.stderr,
)
return 1
- print(f"Matches the figures published on {manifest['page']}.")
+ print(
+ f"Reproduces every figure pinned in PAGE_FIGURES for {manifest['page']}. "
+ "It does not check which exchanges that page shows, or where; nothing "
+ "here reads the page."
+ )
return 0