fix: two-pass Pass 2 needs the chunk text (quotes were invented) + claim cap
Live cloud run 20261026-164236 found both on the wire:
1. TypeClaim carried ONLY the claim — the model could not copy the
verbatim quote from anywhere, so it invented one and the containment
check rejected 69/70 candidates (the safety net working, the
CONTRACT wrong). Fix: TypeClaim gains the chunk text; the model finds
the real quote there ('find the VERBATIM quote here, copied exactly').
2. One charge per claim starved the budget: ~70 claims ate all 80
llm_calls before Q2 (80/80, baseline fallback, no FINAL). Fix:
max_claims_per_chunk=6 (each claim costs a TYPE call; without a cap
one big article starves the run).
The speed win is real and kept: CLAIMS 14-20s/chunk, TYPE 2.8-8s/claim
(the 40-minute output budget is gone). Honest note: the cap bounds per
chunk, not the whole run (3 articles x 6 chunks x 7 calls ~ 126 > 80)
— if the run starves again, next lever is claim selection or a lower
cap, his call.
TDD: two_pass_extract 5/5 on the new contract (TypeClaim fields
{claim,text,fact}). Suite: 29 test files green.
This commit is contained in:
@@ -61,7 +61,7 @@ def test_extract_claims_signature():
|
||||
def test_type_claim_signature():
|
||||
"""Pass 2: one claim -> one typed Fact; orders NEVER produced here."""
|
||||
fields = set(TypeClaim.__fields__)
|
||||
assert fields == {"claim", "fact"}, fields
|
||||
assert fields == {"claim", "text", "fact"}, fields # text: the quote must be COPIED from it (live finding: without it, 69/70 invented quotes rejected)
|
||||
f = TypeClaim.model_fields["fact"].annotation
|
||||
assert "Fact" in str(f), f
|
||||
# Fact KEEPS orders (the legacy single-pass path and table frags use
|
||||
@@ -88,7 +88,7 @@ def test_fact_from_claim_types_one_fact():
|
||||
object="Spain", quote="is a Spanish politician who has been the "
|
||||
"prime minister of Spain since 2018",
|
||||
start="2018", end=None, point=None, granularity="year")))
|
||||
f = fact_from_claim(e, claim="Pedro Sanchez is the prime minister of Spain since 2018")
|
||||
f = fact_from_claim(e, claim="Pedro Sanchez is the prime minister of Spain since 2018", text="...")
|
||||
assert f.subject == "Pedro Sanchez" and f.start == "2018", f
|
||||
print("ok: fact_from_claim returns the typed Fact for one claim")
|
||||
|
||||
@@ -97,7 +97,7 @@ def test_honest_empty():
|
||||
e = Scripted(claims=Scripted(claims=[]))
|
||||
assert claims_from(e, entities="", heading="", text="") == []
|
||||
e2 = Scripted(typeclaim=Scripted(fact=None))
|
||||
assert fact_from_claim(e2, claim="") is None
|
||||
assert fact_from_claim(e2, claim="", text="") is None
|
||||
print("ok: no claims -> no facts; untypeable claim -> None, no invention")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user